Speed tweaks

Optimized, added more tuning options, included a naive profiler