cleaning up server side code