Restructured js files and general cleanup