Tried adding in extra set of if/else logic to get past error