wrote function to create object that holds a function.