simplify parsing code