updated drawing code