Improved functional wrapper.