Restructued js files to scale better + other large changes