Optimized drawing routine
added polarity of switch