Looks like an abstraction is needed here.