rewriting drawing code to use pads