refactor and panel