moved detect and helper stuff into own files