layout changes and refactoring