more robust class recognition