Took out unnecessary code for painted