Refactor to use cli library