added some perf improvements