This commit contains a few changes that had to go in together.