Move if statement to proper place.