Sorted Code

Rearranged code in preparation for handoff.
All non-essential code is stored in "unused".