`flatten_hash` seems unnecessary; why not just use the right keys in the hash in the first place?