clean up log function and some commentary