modified to skip empty lines