Dividing the code into classes and logging to file