Added socket server and cleaned up code using logger class