Generate the right structure.