Made a few tweaks to hopefully speed up execution.