refactor out utils to separate library