Cleanup (fix spacing, indentation, consistency), properly escape regexes