change structure of js & templates