Refactor networking code for creating a user