Fixed some JavaScript issues with the new structure