Move context menu code to new file