working on recursive query