minor refactoring for pieceRecognizer