Passing the function into action