new method of logging, clean up, small fixes