refactor and add right-click