Getting ready for refactoring

Split out context menu
Removed some unused functions