Minor code performance improvements