rewrite painter.update to cleaner coffeescript syntax