Reorganized server-side code to better group functionally related blocks of code together.