add layout and update index