Discover refactoring mayhem.

- Various tweaks and fixes