moving helper functions into fracutils, adding tests (yeah, I know...)