Refactoring

Just a couple of commits that didn't get added on #273.