Revert "Revert "if test""

This reverts commit 1bd0f28f6af7c9870f7a812e5e32ea76298fad6d.