cleaned up code in onDraw() and onSizeChanged()