Cleanup report-common.js a bit, adds missing helper functions