Implemented toFunction; Resolves #69.