Factored drawing code into function, removed scratch file