Added recursive recognition; line recognition is fully implemented