some refactoring, fixed minor bug with movesCount