refactored, added client/server