Refactor to use cli