Tidied Server Code