Commented and neatened up all Server-side code