cleaning up service detection block by way of including code from atz fork