Reverting parts from PR that didn't compile and changing JS generation to debug mode