first step of refactoring for client server design