cleaned up server side js