I changed this, and added a couple of tests.