Improve and clean up logging and toString implementations