Corrected file read to ignore empty lines.
Fixed indentation error.