commented line 106-126 for test
fixed regex and refactored main loop