Major start of cleanup.

Previous commit was completely working