Tidied up first loop of ProcessLine
Subject should be a bit leaner