Added submodule support

This adds submodule support and fixes #6. I squashed my commits and rebased off latest master.