Making lookup of functions work on delegated modules.

Also moved some utility functions temporarily to core.