replaced i with prevAll() count