a couple of optimizations