update code for multi layouts