fixed failing unit test and refactored right click functionality