added detection range -r parameter to main