Improved files handling for strange situations (file starting with white characters, first lines empty &c.)
Heuristic fixed. Works for even-sized problems. Needs a little hack for the odd-sized ones.