Split the server into some neat modules; Add authentication checks to all API calls deserving protection