implemented better painting version