refactoring, layout fixes