Go back to having a takeModule instead of a getModule.

Returning a std::unique_ptr is more constrained. Thanks to David Blaikie for the
suggestion.