removes unnecessary if