Moved cost data formatting from ruby to javascript
Fixed typo and removed redundant code