refactoring contentpanel