optimized some ajax stuff