Reworked javascript to use typescript. Prep more javascript work on the frontend. Fixed #54