Refactor with an abstraction

I don't know, maybe you have a reason for keeping it so explicit, but this is a lot simpler...