Removed unused template
Some code refactoring for JS