refactoring location js
refactoring template for index page
refactoring template for rules page
refactoring template for rules page