added gems and changed routine