Beginning of refactoring to make more readable and more efficient. Yay for untested code.
Oh shit everything works for a change!
Cleaned up the stuff that works.
Arms recalibrated.
Merge branch 'refactor'