Perf tuning 2

Some performance improvements using the hornstein.xml import as a benchmark.