improve js loading and ajax interaction