Remove unused modules.

Also sort modules, remove a few unused other variables, whitespace cleanup.