Several performance improvements

This is what was used in evaluations.