refactored to use pure.js as template rendering