We could make this function more general just by checking the type of the second parameter. In this case, I don't see why we should create more functions when we can just do it here.