moved recognition logic to controller