Convert 'removeComments' from recursive implementation to while loop (no risk of stack overflow for large files)