Better logic for inserting and selecting content when inserting sections