Added a little pin control code and revised timer ISR structure