(And it's complex, which makes it harder to fix than just hardcoding things)