added the parsing logic for the input