Now parsing each section and closing off each level properly.
Added ability to complain smartly if valid input file wasn't provided.
Added new debug option to see what line sections change out.
Added line number to error output.