Some performance tweaks, resulting in about 10% faster performance.