added two asserts, and cleaned up debug