updated parser logic with properly staged parser