Improved logging slightly, added documentation