Small optimizations 1

A couple of small optimizations.