TODO: check equals, define sections, restore references