refactored cli command parsing