Oh yeah, I should just make a function to do that. At least it's only copied in two places. It's also copied on the client, since it uses flattened arrays too :P