Parsing logic