better logging and comments