Thank you Julius Koronci for reading the blog and leaving the comment. My guess is you are referring to the solution posted by Richard Kivits in the comments above. We kept with classes because there were classes in the existing code and did not wanted to rewrite the full code.
However if you have an alternative solution, please share the code snippet. I would be happy to learn and improve.