more refactoring. added context menu.