Renaming toFunction to asFunction