Fix issue #20 by caching the input function
Pass in the function as opposed to the function pointer