more half-baked changes, plus moved a function to the utils class