Two small optimizations

I haven't tested the effect of these two changes on the actual performance, yet. Hoping this can help even a tiny bit!