Yet more refactoring because I'm anally retentive about this.