Tidied up some debugging lines/added some comments