Implemented applyFunction