Fix a bunch of stuff; refactor clientside