Some small integrity and performance improvements.