Maybe even split it into a set of small reusable coherent utility classes