Tons of bugfixing done, beginning clearing up code