Added remaining server-side code