adding if else logic