Fix for issue #47

Fix for issue #47.
Moved the template generating to the render block. Seems like the template method was throwing erros since it depends on DOM ready to work.