Speedup improvements to plugin