CALC-198 - refactor calc-ui.js