optimize the structure