refactored cli tool