pseudo code for insertPiece - missing getpiece, etc.