code cleanup; ui control updates; add ration dialog, events, plumbing