huge cli refactor