Implemented logging (fixes #1)