Refactoring done, ready for new alpha.

Massive cleanup.