documented and ironed out logging. fixes #44