Wrote cdfind function