Added function 'lapply.ds' and amended some previous functions.