A few optimizations