Some minor performance improvements