adding recursive structure code