solved assignment 3, poor performance due to sub-line tests in checkIfNewLineFound function