refactoring, finishing ajax, working on upgrade