updated the parsing logic