cleaned up chat code, fixed a bunch of things