layout improvements, code refactoring