Refactor Module to Encapsulate group and index

Module represents an instance (defined by group and index)
but most APIs passed module, group, and index around.

Encapsulate the group and index and change APIs to just pass
the Module.