changing the structure of the interrupt routine
got pwm working, now trying to sort out strange bugs