Improved Logging, Doc and refactored.