updated parsing code