refactor util to work universally