refactoring of layouts, added preferences