optimized the drawing code
formatted lines longer than 80 chars and cleanup