revise parsing function