Main changes: scripts/user-defined-states-config.js: lines 781-799 ui/js/main.js: getComparisonString() added and used instead of repeating code, getUnitString() added and used instead of repeating code, lines 251-282, 401-432 plus a lot of clean-up to be able to be able to use JSHint & JSCS for checking