Minor optimization on paint method