a few performance optimizations