refactored lots of the server api code