Javascript changes

Moved a lot of work to the C# side