refactoring piece and square classes