Changed file keyword var.
Made line recognition much more robust.