fixes up a bunch of ajax and notify stuff, refactor some.