added error function in case file opening doesn't work
added tentative heuristic function; let's see how it works!
...it's a good idea not to forget your return type
made the heuristic stronger