added json changes and reworked js logic to use them. Still working out bugs though