Improved Logging and several Bug Fixes