Moved mapping to different js file for logic sharing, updated template for multiple js files