add painting function