Make finding and installing dune.module redux

These changes were meant as an improvement to #373, but I didn't get to push them before it was merged.