updating to return function