Refactor server and implement account instantiation