Made changes so that importing will stop if activity stops