Fixing tests, and making code better along the way!