Source module interface changes

This should be merged in after #1007 is accepted.

Refactoring to SourceModule implementations and interface so 'define' and 'use' time dependencies are treated separately.