refactor to use cli