Progress on separating the code into pieces and controlling onContextMenu events.