Refactoring in order to remove the lodash dependency.