updated ajax calls and worked out loading