Tidied up file input to avoid fscanf warnings.