updated for reading empty lines