Rewritten module system.

Big changes. Wait for documentation updates.