added documentation, simplyfied my heuristic