change some if/else logic