Added M flag to regex so comment regex can match start and end of each line. Fixed matching bug where statements were matched even if they were commented out. Optimized regex by saving and reusing the compiled regex object. Removed duplicated checks for "match is not None" and replaced with a filter(). Added some comments.