Changes based on input from Michael Kahl.