Mostly done just needs debugging.