Improved organization and removed inline html

Took advantage of underscore.js _.template function.