Fixed jquery issues and added loading gif