There were already too many return values and I've made it worse. I'll see if it makes sense to use a struct.