cleanup and minor ajax work