Did lots of debugging