Fixes for timing, optimizations