move util funcs into separate file