optimize layouts