Removed some things I used for debugging, tidy'd up my code a bit.