Added Logger and refactored