calc-ui: some fixes to remove use of globals.