completed when/then parsing