fixed heuristic added counter, needs threading