Moving wiring.c functions from timer0 to timer1

I am using an Arduino Leonardo (ATMEGA32U4) and need to use timer0 for pwm. Since by default in the wiring.c file the functions micros() and millis() use timer0, i decided that since timer1 isn't being used, i could set up timer1 exactly how timer0 is set up for the micros() and millis() functions and modify their code so that it all uses timer1 instead of timer0.

I think in theory this should work. I read the datasheet and timer1, while being a 16-bit timer, can run in an 8-bit fast pwm mode (which is what timer0 is set up for). So i modified the wiring.c to do as above: adjusted the prescaler to match the original for timer0 (f/64) and put the timer1 into fast-pwm 8-bit mode.

I modified any functions in wiring.c that used any register from timer0 and changed them to use the corresponding registers in timer1.

However, the problem is that it seems like i did everything right, but when i try to run a simple program that calls Serial.println("hello world"), it is messed up. The output instead shows a repeated 'h' character to the serial console. I'm not really sure whats wrong and wondering if anyone can help.

Here is a link to a pastebin containing my re-written wiring.c file that essentially moves all the functionality from timer0 to timer1:

Any library, that assumes that timer 1 is available for free use, will kill your project.

I understand that. However, even with an empty arduino sketch, just simply printing to console is not working. From my reading, Arduino does not use timer1 for anything. Am I missing something?

Update: I have narrowed down the problem to one line of code:

sbi(TIMSK1, TOIE1);

For some reason, enabling the overflow interrupt on timer1 causes the arduino to freak out. In my Hello World program, which just prints 'hello world' once, it will repeatedly print if i enable timer1 overflow interrupt.

Still not sure why, but i may be closing in on a solution.

Did you also change the ISR vectors in the library code?

Just an update: the problem was that I was not disabling the interrupt on TIMER0. Having the interrupt enabled on TIMER0 and TIMER1 meant that I was never servicing the interrupt on TIMER0. I was able to successfully move the arduino wiring.c to TIMER1 and all the functions work exactly the same!