Major Breakpoint Code Optimization

Removed a lot of N^2 algorithms