Did a lot of debugging