Cleaning up the code and removing logger dependency