Closes #6 (Logging) and Fixes #11 (Error handling).