Refactor logging and exception handling
Remove unnecessary dependency