Doc updates
Pep8 and optimization. Only run the regexs once