adding recursive version