Refactored client and server into separate modules