Refactoring to layout and views