simplify drawing code