Refactores code to user Underscore template