Partial commit

Partial commit of working js file so I can re-structure the code