Some index changes and more if logic