Changed algorithms a bit. Made dfsCount and prevV global vars