Overhauled. Cleaner, but yet untested on hardware
derp typo
fixed json stuff