Add getModules helper function

This is a pull request for issue #1