Improved logging and message printing.
Fix #18