minor optimizations (I hope)