updated factory to return an function that returns an object with the desired values