Initial refactor of server route handling