wrapped server side js in a function