Clean up some debug and add some comments