refactored files used by server and client