added r logger to ui and started refactoring calc.js