Fixed recognition logic