curried functions and rename vars to be more user friendly