Added -r option to disable recursive scanning