* Moved JavaScript that binds to an event to its own file, to keep the explanation simple
* Separarted js into two files, to keep it simple
* fixed some minor bugs in js and templates