adding conditional logic