Clean up some processing code

With the magic of Regex©!