move if to separate block