Using cond instead of if
Default return value for detect