fixing layout and edit logic