reworked some bottlenecks after profiling