Incorporating underlyingFunction. Seems to be working.