Use update() instead of repaint()