added recursive functionality ++