parser and logic for the text input