remove debugging code, add some comments