Refactoring to use anonymous functions
Adding new requirements