Use a pre-order search

Should help with the conditional check.