changed swap process to ajax calls