Add reduce function
Add reduce function
Add reduce function
Add substitute function
Refactoring
Add substitute function
Add substitute function