refactored messages to and from CLI