Layout improvements and code refactoring.