Refactoring code and layout improvements.