optimize in regard to browser repaint