making a few more optimizations