We took the codes exactly like in the links mentioned above that code block. Also, the fact that CRLF has two characters, complicates the algorithm, because you need to look ahead.