perf improvement, from code review