remove debugging code
coding guidelines
factor conditional save