cleanup of ajax replies and some in main.js