Improve handling of missing explicit imports

Although the implementation leaves something to be desired
Rearrange exports environment

Now a map of modules rather than a map of module keys to module values.
Also allows us to detect imports from modules that don't exist.
Remove unused imports