Consolidate code and add functionality to the base function
Consolidate code and add functionality to the base function