had if/else logic switched