two heuristics from book implemented