speed up rendering. found bottlenecks by profiling.