Setting up layout and refactoring