solved the formatting issue with a tip from Nathan.

figured out the regex (explained in code). Still need to remove the function. cleaned up the comments a bit.