working on recursive logic