...and more refactoring...

I really should have done all that before starting. :)