adding server class and cleaning up