Another refactor of js files