Refactored using mustache.js