Added a few conditionals so empty text is not parsed. Got parsing to work completely correctly for minor sample file.