Added lapply function