Huge overhall

rewrote most code.  Fully functional now, no bugs.
Merge pull request #1 from Tannyr/member-reassignment

Huge overhall