Added getPieces function