Up until draw function