Revert "Reordered if else statement"

This reverts commit 11036634d0958cddf90cbc6a8a4535138421e49d.