trying to factor things a bit more nicely