cleaning up code and making server logging clear