profiling + optimizations