refactored logging into separate class