some refactoring fixing repaint for compensation