removes duplicate javascript code
simplifies formatValue method and adds a shorthand for millions