refactoring of PuzzlesView.java