remove the duplicate code configure_gem and put it after if and else condition