passes required vars to function.