change to recursive calls