Completely refactoring current functions into client and server roles, making a mess.