Some small efficiency improvements