better logging and documentation