Moved helper fns to util.