formatting update
Rewrite pattern matching

This way the pattern should not be created and overwritten every time a
line is read.