Fixed bugs, detection file now produces data but should probably be renamed