added helper functions from old code, root files