Massive rewrite of code. Clean up and optimizations.
New files for work