Streamlined the parsing code