added exception handling to catch incorrectly formatted lines