diff --git a/DESCRIPTION b/DESCRIPTION
index 5e4961f976d57082891aa25b18f0bb9a3515b702..ef8ba0abeb2e598694ae39996b6b0ffe1b58453a 100755
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -33,7 +33,8 @@ Suggests:
     xcms (>= 1.37.1),
     CAMERA,
     ontoCAT,
-    RUnit
+    RUnit,
+	enviPat
 Collate:
 	'alternateAnalyze.R'
     'createMassBank.R'
diff --git a/R/Isotopic_Annotation.R b/R/Isotopic_Annotation.R
index 8d08545b154588940dabc439e64c50b7bfa7b90f..be74a552ec2125db042bf4a000a854dcc57a1b91 100644
--- a/R/Isotopic_Annotation.R
+++ b/R/Isotopic_Annotation.R
@@ -29,9 +29,9 @@ checkIsotopes <- function(w, mode = "pH", intensity_cutoff = 5000, intensity_pre
 							isolationWindow = 4, evalMode = "complete", plotSpectrum = TRUE, settings = getOption("RMassBank")){
 
 	# Load library and data
-	require(enviPat)
-	data("isotopes")
+	requireNamespace("enviPat",quietly=TRUE)
 	
+	data("isotopes", package="enviPat")
 	
 	if(!(intensity_precision %in% c("none","low","high"))){
 		stop('intensity_precision must be specified as either "none", "low" or "high"')
@@ -116,11 +116,14 @@ checkIsotopes <- function(w, mode = "pH", intensity_cutoff = 5000, intensity_pre
 		# Find parent formula and cpdID
 		parent_formula <- add.formula(spec@formula, allowed_additions)
 		id <- as.numeric(spec@id)
-		
+		specNum <- 0
+		specEnv <- environment()
 
 		# lapply over all extracted MS2 spectra
 		lapply(spec@children, function(msmsdata){
 			
+			specEnv$specNum <- specEnv$specNum + 1
+			
 			# Extract currently relevant peaks
 			currentMPeaks <- matchedPeaks[(matchedPeaks$cpdID == id) & (matchedPeaks$scan == msmsdata@acquisitionNum),,drop=FALSE]
 			currentUPeaks <- unmatchedPeaks[(unmatchedPeaks$cpdID == id) & (unmatchedPeaks$scan == msmsdata@acquisitionNum),,drop=FALSE]
@@ -132,7 +135,7 @@ checkIsotopes <- function(w, mode = "pH", intensity_cutoff = 5000, intensity_pre
 			# Sort pattern by abundance
 			isoMPatterns <- lapply(currentMPeaks$formula, function(formula){
 				# Find pattern
-				pattern <- as.data.frame(isopattern(formula, isotopes = isotopes)[[1]])
+				pattern <- as.data.frame(enviPat::isopattern(formula, isotopes = isotopes)[[1]])
 				mass <- findMz.formula(formula,"")$mzCenter
 				
 				# Find index of nonisotopic molecule and
@@ -221,6 +224,14 @@ checkIsotopes <- function(w, mode = "pH", intensity_cutoff = 5000, intensity_pre
 			# Which isotope patterns still have theoretical intensities above the cutoff?
 			peaksToCheck <- which(as.logical(sapply(isoMPatterns,nrow)))
 			
+			if(!length(peaksToCheck)){
+				warning(paste0("The peaks of compound ", id, " in spectrum #", specEnv$specNum," are not intense enough to search for isotopic peaks"))
+				if(plotSpectrum){
+					plot(currentMPeaks$mzFound, currentMPeaks$intensity,type="h", main=paste(id,findName(id)), col="black", xlab="m/z", ylab="intensity", lwd=3)
+				}
+				return(0)
+			}
+			
 			# Now, look for isotopic patterns in unmatched peaks with all specified parameters
 			if("add" %in% evalMode){
 				# Which peaks have no correct formula annotation as of now?
@@ -384,10 +395,11 @@ checkIsotopes <- function(w, mode = "pH", intensity_cutoff = 5000, intensity_pre
 			        }
 			        if(nrow(correctionMatrix)){
 			            points(correctionMatrix$mzFound, correctionMatrix$intensity,type="h", col="yellow", lwd=3)
+						if(nrow(conflictedMatrix)){
+							points(conflictedMatrix$mzFound, conflictedMatrix$intensity,type="h", col="red", lwd=3)
+						}
 			        }
-			        if(nrow(conflictedMatrix)){
-			            points(conflictedMatrix$mzFound, conflictedMatrix$intensity,type="h", col="red", lwd=3)
-			        }
+
 			    }
 			}
 			return(0)
diff --git a/R/RmbWorkspace.R b/R/RmbWorkspace.R
index 69fd5dbab8fb4f0ca4ccbdc3d561056bd7ad8952..91d73b9a8f5c51bfb3d5efe4924fe121e0ceaa41 100755
--- a/R/RmbWorkspace.R
+++ b/R/RmbWorkspace.R
@@ -354,14 +354,7 @@ setMethod("show", "msmsWorkspace",
 						
                         ## msmsWorkflow: Step 4. Recalibrate m/z values in raw spectra
 						if(4 %in% progress){
-							cat("Peaks found after Step 4:\n")
-							dummy <- sapply(object@spectra, function(x) cat(" -", x@id, "\t found:", x@found, "\n"))
-							cat("Peaks found:\n")							
-							dummy4 <- sapply(object@spectra, function(x){ 
-																		cat(" -", x@id, "\t peaks:",
-																			sapply(x@children, function(s) s@peaksCount), "\n")
-																			return(sapply(x@children, function(s) s@peaksCount))
-																		})
+							cat("Peaks successfully recalibrated:\n")
 						}
 						
                         ## msmsWorkflow: Step 5. Reanalyze recalibrated spectra
diff --git a/R/alternateAnalyze.R b/R/alternateAnalyze.R
index 98f8856f2f168cc106a78bb665946c733df2636e..fd11ab752c3192d7da878a006d5344432ced007a 100644
--- a/R/alternateAnalyze.R
+++ b/R/alternateAnalyze.R
@@ -83,14 +83,11 @@ analyzeMsMs.optimized <- function(msmsPeaks, mode="pH", detail=FALSE, run="preli
   if(method=="formula")
   {
     return(analyzeMsMs.formula.optimized(msmsPeaks, mode, detail, run, filterSettings,
-                               spectraList, fragData, fragDataIndex
-    ))
+                               spectraList, fragData, fragDataIndex))
   }
   else if(method == "intensity")
   {
-    return(analyzeMsMs.intensity(msmsPeaks, mode, detail, run, filterSettings,
-                                 spectraList
-    ))
+    return(analyzeMsMs.intensity(msmsPeaks, mode, detail, run, filterSettings))
   }
 }
 
diff --git a/R/leMsMs.r b/R/leMsMs.r
index 5dc5b5bbe71ad51760696565217533b809b36d04..6d2d850a66be9b6ae8444a6d286e94002f1f3d4e 100755
--- a/R/leMsMs.r
+++ b/R/leMsMs.r
@@ -1145,6 +1145,7 @@ processProblematicPeaks <- function(w, mode, archivename = NA)
 					,,drop=FALSE], peaksMatched(w), mode)
 	fp$OK <- rep('', nrow(fp))
 	fp$name <- rownames(fp)
+	
 	fp <- fp[with(fp, 
 					order(cpdID, mzCalc, scan)),
 	]
@@ -1367,10 +1368,10 @@ plotRecalibration.direct <- function(rcdata, rc, rc.ms1, title, mzrange,
 	if((length(unique(rcdata$mzFound))>1) & 
 			(length(unique(rcdata$recalfield))>1))
 	{
-		if(require(gplots))
+		if(requireNamespace("gplots",quietly=TRUE))
 		{
 			
-			hist2d(rcdata$mzFound, rcdata$recalfield, 
+			gplots::hist2d(rcdata$mzFound, rcdata$recalfield, 
 					col=c("white", heat.colors(12)), xlab="m/z", 
 					ylab = ylab.plot, main=paste(title, "density"))
 			lines(RcModelMz, RcModelRecal, col="blue")
diff --git a/R/leMsmsRaw.R b/R/leMsmsRaw.R
index 54b6f56179c951630cb90137c1f2c0c389527e3a..ca7dee120f2b9144cf154fd249146f24af336190 100644
--- a/R/leMsmsRaw.R
+++ b/R/leMsmsRaw.R
@@ -359,12 +359,12 @@ findMsMsHR.direct <- function(msRaw, cpdID, mode = "pH", confirmMode = 0, useRtL
 #' @export
 findMsMsHRperxcms <- function(fileName, cpdID, mode="pH", findPeaksArgs = NULL, plots = FALSE, MSe = FALSE){
 	
-	
-	
+	# Find mz
 	mzLimits <- findMz(cpdID, mode)
 	mz <- mzLimits$mzCenter
 	
-
+	
+	# If there are more files than cpdIDs
 	if(length(fileName) > 1){
 		fspectra <- list()
 		
@@ -374,7 +374,8 @@ findMsMsHRperxcms <- function(fileName, cpdID, mode="pH", findPeaksArgs = NULL,
 		
 		spectra <- toRMB(unlist(unlist(fspectra, FALSE),FALSE), cpdID, mode)
 		
-	} else if(length(cpdID) > 1){
+	} else if(length(cpdID) > 1){ # If there are more cpdIDs than files
+	
 		spectra <- findMsMsHRperxcms.direct(fileName, cpdID, mode=mode, findPeaksArgs = findPeaksArgs, plots = plots, MSe = MSe)
 		
 		P <- lapply(1:length(spectra), function(i){
@@ -387,7 +388,7 @@ findMsMsHRperxcms <- function(fileName, cpdID, mode="pH", findPeaksArgs = NULL,
 		})
 		return(P)
 		
-	} else {
+	} else { # There is a file for every cpdID
 		spectra <- toRMB(unlist(findMsMsHRperxcms.direct(fileName, cpdID, mode=mode, findPeaksArgs = NULL, plots = FALSE, MSe = FALSE),FALSE))
 	}
 	
@@ -406,15 +407,15 @@ findMsMsHRperxcms <- function(fileName, cpdID, mode="pH", findPeaksArgs = NULL,
 #' @export
 findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs = NULL, plots = FALSE, MSe = FALSE) {
 	
-	require(CAMERA)
-	require(xcms)
+	requireNamespace("CAMERA",quietly=TRUE)
+	requireNamespace("xcms",quietly=TRUE)
 	
 	##
 	## getRT function
 	##
 	
 	getRT <- function(xa) {
-		rt <- sapply(xa@pspectra, function(x) {median(peaks(xa@xcmsSet)[x, "rt"])})
+		rt <- sapply(xa@pspectra, function(x) {median(xcms::peaks(xa@xcmsSet)[x, "rt"])})
 	}
 	
 	##
@@ -422,13 +423,13 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs =
 	##
 	
 	# Read file
-	suppressWarnings(xrmsms <- xcmsRaw(fileName, includeMSn=TRUE))
+	suppressWarnings(xrmsms <- xcms::xcmsRaw(fileName, includeMSn=TRUE))
 	
 	
 	# If file is not MSe, split by collision energy
 	if(MSe == FALSE){
 		# Also, fake MS1 from the MSn data
-		suppressWarnings(xrs <- split(msn2xcmsRaw(xrmsms), f = xrmsms@msnCollisionEnergy))
+		suppressWarnings(xrs <- split(xcms::msn2xcmsRaw(xrmsms), f = xrmsms@msnCollisionEnergy))
 	} else{
 		# Else, MSn data will already be in MS1
 		xrs <- list()
@@ -436,7 +437,7 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs =
 	}
 	
 	# Fake s simplistic xcmsSet
-	suppressWarnings(setReplicate <- xcmsSet(files=fileName, method="MS1"))
+	suppressWarnings(setReplicate <- xcms::xcmsSet(files=fileName, method="MS1"))
 	xsmsms <- as.list(replicate(length(xrs),setReplicate))
 	
 	mzabs <- 0.1
@@ -470,23 +471,23 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs =
 		# Go over every collision energy of the MS2
 		for(i in 1:length(xrs)){
 		
-			suppressWarnings(capture.output(peaks(xsmsms[[i]]) <- do.call(findPeaks,c(findPeaksArgs, object = xrs[[i]]))))
+			suppressWarnings(capture.output(xcms::peaks(xsmsms[[i]]) <- do.call(xcms::findPeaks,c(findPeaksArgs, object = xrs[[i]]))))
 			
-			if (nrow(peaks(xsmsms[[i]])) == 0) {
+			if (nrow(xcms::peaks(xsmsms[[i]])) == 0) {
 			  XCMSspectra[[i]] <- matrix(0,2,7)
 			  next
 			} else{	
 			
 				# Get the peaklist
-				pl <- peaks(xsmsms[[i]])[,c("mz", "rt"), drop=FALSE]
+				pl <- xcms::peaks(xsmsms[[i]])[,c("mz", "rt"), drop=FALSE]
 
 				# Find precursor peak within limits
 				candidates <- which( pl[,"mz", drop=FALSE] < parentMass + mzabs & pl[,"mz", drop=FALSE] > parentMass - mzabs
 								& pl[,"rt", drop=FALSE] < RT * 1.1 & pl[,"rt", drop=FALSE] > RT * 0.9 )
 				
 				# Annotate and group by FWHM (full width at half maximum)
-				capture.output(anmsms <- xsAnnotate(xsmsms[[i]]))
-				capture.output(anmsms <- groupFWHM(anmsms))
+				capture.output(anmsms <- CAMERA::xsAnnotate(xsmsms[[i]]))
+				capture.output(anmsms <- CAMERA::groupFWHM(anmsms))
 				
 				# If a candidate fulfills the condition, choose the closest and retrieve the index of those pesudospectra
 				if(length(candidates) > 0){
@@ -502,12 +503,12 @@ findMsMsHRperxcms.direct <- function(fileName, cpdID, mode="pH", findPeaksArgs =
 				
 				# If the plot parameter was supplied, plot it
 				if((plots == TRUE) && (length(pspIndex) > 0)){
-					plotPsSpectrum(anmsms, pspIndex, log=TRUE,  mzrange=c(0, findMz(cpdID)[[3]]), maxlabel=10)
+					CAMERA::plotPsSpectrum(anmsms, pspIndex, log=TRUE,  mzrange=c(0, findMz(cpdID)[[3]]), maxlabel=10)
 				}
 				
 				# If there is a number of indexes, retrieve the pseudospectra
 				if(length(pspIndex) != 0){
-					XCMSspectra[[i]] <- getpspectra(anmsms, pspIndex)
+					XCMSspectra[[i]] <- CAMERA::getpspectra(anmsms, pspIndex)
 				} else {
 				# Else note the spectrum as missing
 					whichmissing <- c(whichmissing,i)
@@ -695,7 +696,7 @@ toRMB <- function(msmsXCMSspecs = NA, cpdID = NA, mode="pH", MS1spec = NA){
 				mz = pks[,"mz"],
 				intensity = pks[,"int"],
 				precScanNum = as.integer(1),
-				precursorMz = findMz(cpdID)[[3]],
+				precursorMz = findMz(cpdID)$mzCenter,
 				precursorIntensity = 0,
 				precursorCharge = as.integer(1),
 				collisionEnergy = 0,
@@ -707,14 +708,7 @@ toRMB <- function(msmsXCMSspecs = NA, cpdID = NA, mode="pH", MS1spec = NA){
 		))
 	})
 	
-	msmsSpecs <- as(do.call(c, msmsSpecs), "SimpleList")
-	
-	parentPeak <- matrix(nrow = 1, ncol = 2)
-	colnames(parentPeak) <- c("mz","int")
-	parentPeak[1,] <- c(findMz(cpdID,mode=mode)$mzCenter,100)
-
-				
-				
+	msmsSpecs <- as(do.call(c, msmsSpecs), "SimpleList")			
 				
 	##Build the new objects
 	masterSpec <- new("Spectrum1",
@@ -761,78 +755,71 @@ toRMB <- function(msmsXCMSspecs = NA, cpdID = NA, mode="pH", MS1spec = NA){
 #' 		addPeaksManually(w, cpdID, handSpec)
 #' }
 #' @export
-addPeaksManually <- function(w, cpdID, handSpec, mode = "pH"){
-	
-	##Where do the peaks and the header need to be added?
-	pos <- sapply(w@specs,function(spec){cpdID == spec$id})
-	if(length(pos) == 0) pos <- FALSE
-	
-	childHeader <- matrix(0,1,20)
-	childHeader[,4] <- length(handSpec[,1])
-	childHeader[,5] <- 0
-	childHeader[,6] <- findRt(cpdID)$RT * 60
-	childHeader[,7] <- handSpec[which.max(handSpec[,"int"]),1]
-	childHeader[,8] <- max(handSpec)
-	childHeader[,10] <- 0
-	childHeader[,11] <- min(handSpec[,"mz"])
-	childHeader[,12] <- max(handSpec[,"mz"])
-	childHeader[,13] <- 1
-	childHeader[,14] <- findMz(cpdID)[[3]]
-	childHeader[,15] <- 1 ##Will be changed for different charges
-	childHeader[,16] <- 0 ##There sadly isn't any precursor intensity to find in the msms-scans. Workaround?
-	childHeader[,17:20] <- 0 ##Will be changed if merge is wanted
-	colnames(childHeader) <- c("seqNum", "acquisitionNum", "msLevel", "peaksCount", "totIonCurrent", "retentionTime", "basepeakMZ", 
-										"basePeakIntensity", "collisionEnergy", "ionisationEnergy", "lowMZ", "highMZ", "precursorScanNum",
-										"precursorMZ", "precursorCharge", "precursorIntensity", "mergedScan", "mergedResultScanNum", 
-										"mergedResultStartScanNum", "mergedResultEndScanNum")
-	
-	##If the compound for the cpdID isn't in specs yet, add a new spectrum
-	if(length(which(pos)) == 0){
-		pos <- length(w@specs) + 1
-		childHeader[,1:3] <- 2
-		w@specs[[pos]] <- list()
-		w@specs[[pos]]$foundOK <- 1
-		w@specs[[pos]]$parentscan <- 1
-		w@specs[[pos]]$parentHeader <- matrix(0, ncol = 20, nrow = 1)
-		rownames(w@specs[[pos]]$parentHeader) <- 1
-		colnames(w@specs[[pos]]$parentHeader) <- c("seqNum", "acquisitionNum", "msLevel", "peaksCount", "totIonCurrent", "retentionTime", "basepeakMZ", 
-									"basePeakIntensity", "collisionEnergy", "ionisationEnergy", "lowMZ", "highMZ", "precursorScanNum",
-									"precursorMZ", "precursorCharge", "precursorIntensity", "mergedScan", "mergedResultScanNum", 
-									"mergedResultStartScanNum", "mergedResultEndScanNum")
-		w@specs[[pos]]$parentHeader[1,1:3] <- 1
-		w@specs[[pos]]$parentHeader[1,4:20] <- 0
-		w@specs[[pos]]$parentHeader[1,6] <- findRt(cpdID)$RT * 60
-		w@specs[[pos]]$parentHeader <- as.data.frame(w@specs[[pos]]$parentHeader)
-		w@specs[[pos]]$childScans <- 2
-		w@specs[[pos]]$childHeaders <- as.data.frame(childHeader)
-		w@specs[[pos]]$parentPeak <- matrix(nrow = 1, ncol = 2)
-		colnames(w@specs[[pos]]$parentPeak) <- c("mz","int")
-		w@specs[[pos]]$parentPeak[1,] <- c(findMz(cpdID,mode=mode)$mzCenter,100)
-		w@specs[[pos]]$peaks <- list()
-		w@specs[[pos]]$peaks[[1]] <- handSpec
-		w@specs[[pos]]$mz <- findMz(cpdID,mode=mode)
-		w@specs[[pos]]$id <- cpdID
-		w@specs[[pos]]$formula <- findFormula(cpdID)
-		colnames(w@specs[[pos]]$childHeaders) <- c("seqNum", "acquisitionNum", "msLevel", "peaksCount", "totIonCurrent", "retentionTime", "basepeakMZ", 
-										"basePeakIntensity", "collisionEnergy", "ionisationEnergy", "lowMZ", "highMZ", "precursorScanNum",
-										"precursorMZ", "precursorCharge", "precursorIntensity", "mergedScan", "mergedResultScanNum", 
-										"mergedResultStartScanNum", "mergedResultEndScanNum")
-	} else { 
-			pos <- which(pos)
-			w@specs[[pos]]$childHeaders <- rbind(w@specs[[pos]]$childHeaders,childHeader)
-			w@specs[[pos]]$childHeaders[,1] <- 2:(nrow(w@specs[[pos]]$childHeaders)+1)
-			w@specs[[pos]]$childHeaders[,2] <- w@specs[[pos]]$childHeaders[,1]
-			w@specs[[pos]]$childScans <- c(w@specs[[pos]]$childScans,max(w@specs[[pos]]$childScans)+1)
-			w@specs[[pos]]$peaks[[length(w@specs[[pos]]$peaks)+1]] <- handSpec
-		}
+addPeaksManually <- function(w, cpdID = NA, handSpec, mode = "pH"){
+
+			
+	if(is.na(cpdID)){
+			stop("Please supply the compoundID!")
+	}
+	
+	# For the case that the cpdID turns up for the first time
+	# a new spectrumset needs to be created
+	if(!(cpdID %in% sapply(w@spectra,function(s) s@id))){
 		
-		return(w)
+		# Create fake MS1 spectrum
+		masterSpec <- new("Spectrum1",
+			mz = findMz(cpdID,mode=mode)$mzCenter,
+			intensity = 100,
+			polarity = as.integer(0),
+			peaksCount = as.integer(1),
+			rt = findRt(cpdID)$RT,
+			acquisitionNum = as.integer(1),
+			tic = 0,
+			centroided = TRUE
+		)
+		
+		# Create fake spectrumset
+		spectraSet <- new("RmbSpectraSet",
+			parent = masterSpec,
+			found = TRUE,
+			#complete = NA,
+			#empty = NA,
+			id = as.character(as.integer(cpdID)),
+			formula = findFormula(cpdID),
+			mz = findMz(cpdID,mode=mode)$mzCenter,
+			name = findName(cpdID),
+			mode = mode
+			#annotations = list()
+		)
+		
+		w@spectra[[length(w@spectra) + 1]] <- spectraSet
+	}
+	
+	specIndex <- which(cpdID == sapply(w@spectra, function(s) s@id))
+	
+	# New spectrum object
+	w@spectra[[specIndex]]@children[[length(w@spectra[[specIndex]]@children) + 1]] <- new("RmbSpectrum2",
+				mz = handSpec[,"mz"],
+				intensity = handSpec[,"int"],
+				precScanNum = as.integer(1),
+				precursorMz = findMz(cpdID)$mzCenter,
+				precursorIntensity = 0,
+				precursorCharge = as.integer(1),
+				collisionEnergy = 0,
+				tic = 0,
+				peaksCount = nrow(handSpec),
+				rt = findRt(cpdID)$RT,
+				acquisitionNum = as.integer(length(w@spectra[[specIndex]]@children) + 2),
+				centroided = TRUE)
+	return(w)
 }
 
+
 createSpecsFromPeaklists <- function(w, cpdIDs, filenames, mode="pH"){
-		for(j in 1:length(filenames)){
-			w <- addPeaksManually(w,cpdIDs[j],as.matrix(read.csv(filenames[j]), header=TRUE),mode)
-		}
+	for(j in 1:length(filenames)){
+		w <- addPeaksManually(w,cpdIDs[j],as.matrix(read.csv(filenames[j]), header=TRUE),mode)
+	}
+	
 	return(w)
 }
 
diff --git a/R/msmsRead.R b/R/msmsRead.R
index 67dac46719c932245abde4f36da07885d6e62b13..007a8cfb4ef239c16f1fad7326000394eef6460e 100644
--- a/R/msmsRead.R
+++ b/R/msmsRead.R
@@ -141,8 +141,8 @@ msmsRead <- function(w, filetable = NULL, files = NULL, cpdids = NULL,
 	if(readMethod == "xcms"){
 		
 		##Load libraries
-		require(xcms)
-		require(CAMERA)
+		requireNamespace("xcms",quietly=TRUE)
+		requireNamespace("CAMERA",quietly=TRUE)
 		
 		##Find unique files and cpdIDs
 		ufiles <- unique(w@files)
@@ -204,15 +204,6 @@ msmsRead <- function(w, filetable = NULL, files = NULL, cpdids = NULL,
 		}
 		
 		w@files <- sapply(files,function(file){return(file[1])})
-		specnames <- basename(as.character(w@files))
-		if(length(unique(specnames)) == length(specnames)){
-			names(w@specs) <- basename(as.character(w@files))
-		} else {
-			for(i in 1:length(specnames)){
-				specnames[i] <- paste(i,"_",specnames[i],sep="")
-			}
-		}
-		names(w@specs) <- specnames
 		message("Peaks read")
 		return(w)
 	}
@@ -251,7 +242,7 @@ msmsRead <- function(w, filetable = NULL, files = NULL, cpdids = NULL,
 msmsRead.RAW <- function(w, xRAW = NULL, cpdids = NULL, mode, findPeaksArgs = NULL, 
 							settings = getOption("RMassBank"), progressbar = "progressBarHook", plots = FALSE){
 	
-	require(xcms)
+	requireNamespace("xcms", quietly=TRUE)
 	
 	##xRAW will be coerced into a list of length 1 if it is an xcmsRaw-object
 	if(class(xRAW) == "xcmsRaw"){
@@ -275,7 +266,7 @@ msmsRead.RAW <- function(w, xRAW = NULL, cpdids = NULL, mode, findPeaksArgs = NU
 	#	stop(paste("No msn data in list elements", setdiff(1:length(xRAW),msnExist)))
 	#}
 	
-	require(CAMERA)
+	requireNamespace("CAMERA",quietly=TRUE)
 	
 	parentMass <- findMz(cpdids[1], mode=mode)$mzCenter
 	if(is.na(parentMass)){
@@ -289,7 +280,7 @@ msmsRead.RAW <- function(w, xRAW = NULL, cpdids = NULL, mode, findPeaksArgs = NU
 		rt <- sapply(xa@pspectra, function(x) {median(peaks(xa@xcmsSet)[x, "rt"])})
 	}
 	
-	suppressWarnings(setReplicate <- xcmsSet(files=xRAW[[1]]@filepath, method="MS1"))
+	suppressWarnings(setReplicate <- xcms::xcmsSet(files=xRAW[[1]]@filepath, method="MS1"))
 	xsmsms <- as.list(replicate(length(xRAW),setReplicate))
 	candidates <- list()
 	anmsms <- list()
@@ -298,20 +289,20 @@ msmsRead.RAW <- function(w, xRAW = NULL, cpdids = NULL, mode, findPeaksArgs = NU
 	whichmissing <- vector()
 	metaspec <- list()
 	for(i in 1:length(xRAW)){
-		devnull <- suppressWarnings(capture.output(peaks(xsmsms[[i]]) <- do.call(findPeaks,c(findPeaksArgs, object = xRAW[[i]]))))
+		devnull <- suppressWarnings(capture.output(xcms::peaks(xsmsms[[i]]) <- do.call(xcms::findPeaks,c(findPeaksArgs, object = xRAW[[i]]))))
 		
-		if (nrow(peaks(xsmsms[[i]])) == 0) { ##If there are no peaks
+		if (nrow(xcms::peaks(xsmsms[[i]])) == 0) { ##If there are no peaks
 			spectra[[i]] <- matrix(0,2,7)
 			next
 		} else{	
 			## Get pspec 
-			pl <- peaks(xsmsms[[i]])[,c("mz", "rt"), drop=FALSE]
+			pl <- xcms::peaks(xsmsms[[i]])[,c("mz", "rt"), drop=FALSE]
 
 			## Best: find precursor peak
 			candidates[[i]] <- which( pl[,"mz", drop=FALSE] < parentMass + mzabs & pl[,"mz", drop=FALSE] > parentMass - mzabs
 							& pl[,"rt", drop=FALSE] < RT * 1.1 & pl[,"rt", drop=FALSE] > RT * 0.9 )
-			devnull <- capture.output(anmsms[[i]] <- xsAnnotate(xsmsms[[i]]))
-			devnull <- capture.output(anmsms[[i]] <- groupFWHM(anmsms[[i]]))
+			devnull <- capture.output(anmsms[[i]] <- CAMERA::xsAnnotate(xsmsms[[i]]))
+			devnull <- capture.output(anmsms[[i]] <- CAMERA::groupFWHM(anmsms[[i]]))
 
 				if(length(candidates[[i]]) > 0){
 				closestCandidate <- which.min (abs( RT - pl[candidates[[i]], "rt", drop=FALSE]))
@@ -325,10 +316,10 @@ msmsRead.RAW <- function(w, xRAW = NULL, cpdids = NULL, mode, findPeaksArgs = NU
 				## 3rd Best: find pspec closest to RT from spreadsheet
 				##psp <- which.min( abs(getRT(anmsms) - RT) )
 				if((plots == TRUE) && (length(psp[[i]]) > 0)){
-					plotPsSpectrum(anmsms[[i]], psp[[i]], log=TRUE,  mzrange=c(0, findMz(cpdids[1])[[3]]), maxlabel=10)
+					CAMERA::plotPsSpectrum(anmsms[[i]], psp[[i]], log=TRUE,  mzrange=c(0, findMz(cpdids[1])[[3]]), maxlabel=10)
 				}
 				if(length(psp[[i]]) != 0){
-					spectra[[i]] <- getpspectra(anmsms[[i]], psp[[i]])
+					spectra[[i]] <- CAMERA::getpspectra(anmsms[[i]], psp[[i]])
 				} else {whichmissing <- c(whichmissing,i)}
 			}
 		}
diff --git a/R/validateMassBank.R b/R/validateMassBank.R
index 20dd4369439e28655f245323b09d0060cd0c8f06..db1bd8a3244b33fb5f05ca8ee2b0b9323f9776c4 100644
--- a/R/validateMassBank.R
+++ b/R/validateMassBank.R
@@ -19,8 +19,8 @@
 #' @export
 validate <- function(path, simple = TRUE) {
 
-        require(ontoCAT)
-		require(RUnit)
+        requireNamespace("ontoCAT",quietly=TRUE)
+		requireNamespace("RUnit",quietly=TRUE)
 
 	# Is the argument a directory?
 	# If yes, list the files
@@ -38,12 +38,12 @@ validate <- function(path, simple = TRUE) {
 	tests <- list()
 	for(i in 1:length(RMassBank.env$mb)){
 		if(RMassBank.env$mb[[i]]@compiled_ok[[1]][['AC$MASS_SPECTROMETRY']][['MS_TYPE']] == "MS2" || RMassBank.env$mb[[i]]@compiled_ok[[1]][['AC$MASS_SPECTROMETRY']][['MS_TYPE']] == "MS"){
-		tests[[i]] <- defineTestSuite(Files[i], dirs = system.file(package="RMassBank", "validationTests"), testFileRegexp = "runit.MS2.test.R",
+		tests[[i]] <- RUnit::defineTestSuite(Files[i], dirs = system.file(package="RMassBank", "validationTests"), testFileRegexp = "runit.MS2.test.R",
                 #testFuncRegexp = "^test.+",
                 rngKind = "Marsaglia-Multicarry",
                 rngNormalKind = "Kinderman-Ramage")
 		} else{
-			tests[[i]] <- defineTestSuite(Files[i], dirs = system.file(package="RMassBank", "validationTests"), testFileRegexp = "^runit.MSn.test.[rR]$",
+			tests[[i]] <- RUnit::defineTestSuite(Files[i], dirs = system.file(package="RMassBank", "validationTests"), testFileRegexp = "^runit.MSn.test.[rR]$",
                 #testFuncRegexp = "^test.+",
                 rngKind = "Marsaglia-Multicarry",
                 rngNormalKind = "Kinderman-Ramage")
@@ -51,9 +51,9 @@ validate <- function(path, simple = TRUE) {
 	}
 	print("Starting Tests")
 	# Testing the list of Testsuites
-	testData <- suppressWarnings(runTestSuite(tests,verbose=0))
+	testData <- suppressWarnings(RUnit::runTestSuite(tests,verbose=0))
 	# Prints the HTML-record
-	printHTMLProtocol(testData, fileName = paste0(getwd(),"/report.html"))
+	RUnit::printHTMLProtocol(testData, fileName = paste0(getwd(),"/report.html"))
 	if(simple){
 		fileConnection <- file(paste0(getwd(),"/report.html"), open = "r")
 		htmlFile <- readLines(fileConnection)
@@ -96,8 +96,8 @@ validate <- function(path, simple = TRUE) {
 	# getOntology() has a problem with reading relative Windows paths(it wants an URI),
 	# so the path has to be made absolute
 	# I reckon this should work under Linux without doing that
-	ont <- getOntology(normalizePath(filename))
-	if(is.null(getOntologyAccession(ont))){
+	ont <- ontoCAT::getOntology(normalizePath(filename))
+	if(is.null(ontoCAT::getOntologyAccession(ont))){
 		return(FALSE)
 	}
 	return(TRUE)
@@ -143,11 +143,11 @@ validate <- function(path, simple = TRUE) {
 
 # This is a list of the possible instrument names 
 .getInstruments <- function(){
-	Onto <- getOntology(system.file(package = "RMassBank", "psi-ms.obo"))
-	instrumentTerms <- getAllTermChildrenById(Onto,"MS_1000031")
+	Onto <- ontoCAT::getOntology(system.file(package = "RMassBank", "psi-ms.obo"))
+	instrumentTerms <- ontoCAT::getAllTermChildrenById(Onto,"MS_1000031")
 	instruments <- vector()	
 	for(i in 1:length(instrumentTerms)){
-		instruments[i] <- getLabel(instrumentTerms[[i]])
+		instruments[i] <- ontoCAT::getLabel(instrumentTerms[[i]])
 	}
 	return(instruments)
 }
@@ -176,9 +176,8 @@ smiles2mass <- function(SMILES){
 }
 
 .unitTestRMB <- function(WD=getwd()){
-	require(RUnit)
-	library(RMassBank)
-	require(RMassBankData)
+	requireNamespace("RUnit",quietly=TRUE)
+	requireNamespace("RMassBankData",quietly=TRUE)
 	oldwd <- getwd()
 	setwd(WD)
 	w <- newMsmsWorkspace()
@@ -208,30 +207,29 @@ smiles2mass <- function(SMILES){
 	mb <- loadInfolists(mb, system.file("infolists", package="RMassBankData"))
 	mb <- mbWorkflow(mb)
 	
-	testSuite <- defineTestSuite("Electronic noise and formula calculation Test", dirs = system.file("unitTests", 
+	testSuite <- RUnit::defineTestSuite("Electronic noise and formula calculation Test", dirs = system.file("unitTests", 
 		package="RMassBank"), testFileRegexp = "runit.EN_FC.R",
 					#testFuncRegexp = "^test.+",
 					rngKind = "Marsaglia-Multicarry",
 					rngNormalKind = "Kinderman-Ramage")
-	testSuite2 <- defineTestSuite("Evaluation of data acquisition process", dirs = system.file("unitTests", 
+	testSuite2 <- RUnit::defineTestSuite("Evaluation of data acquisition process", dirs = system.file("unitTests", 
 		package="RMassBank"), testFileRegexp = "runit.DA.R",
 					#testFuncRegexp = "^test.+",
 					rngKind = "Marsaglia-Multicarry",
 					rngNormalKind = "Kinderman-Ramage")			
-	testData <- suppressWarnings(runTestSuite(testSuite))
-	testData2 <- suppressWarnings(runTestSuite(testSuite2))
+	testData <- suppressWarnings(RUnit::runTestSuite(testSuite))
+	testData2 <- suppressWarnings(RUnit::runTestSuite(testSuite2))
 	
 	file.remove(c("pH_narcotics_Failpeaks.csv","pH_narcotics.RData","pH_narcotics_RA.RData","pH_narcotics_RF.RData"))
-	printTextProtocol(testData)
-	printTextProtocol(testData2)
+	RUnit::printTextProtocol(testData)
+	RUnit::printTextProtocol(testData2)
 	setwd(oldwd)
 	return(testData)
 }
 
 .unitTestRMB2 <- function(WD=getwd()){
-	require(RUnit)
-	library(RMassBank)
-	require(RMassBankData)
+	requireNamespace("RUnit",quietly=TRUE)
+	requireNamespace("RMassBankData",quietly=TRUE)
 	oldwd <- getwd()
 	setwd(WD)
 	w <- newMsmsWorkspace()
@@ -264,22 +262,22 @@ smiles2mass <- function(SMILES){
 	mb <- loadInfolists(mb, system.file("infolists", package="RMassBankData"))
 	mb <- mbWorkflow(mb)
 	
-	testSuite <- defineTestSuite("Electronic noise and formula calculation Test", dirs = system.file("unitTests", 
+	testSuite <- RUnit::defineTestSuite("Electronic noise and formula calculation Test", dirs = system.file("unitTests", 
 		package="RMassBank"), testFileRegexp = "runit.EN_FC.R",
 					#testFuncRegexp = "^test.+",
 					rngKind = "Marsaglia-Multicarry",
 					rngNormalKind = "Kinderman-Ramage")
-	testSuite2 <- defineTestSuite("Evaluation of data acquisition process", dirs = system.file("unitTests", 
+	testSuite2 <- RUnit::defineTestSuite("Evaluation of data acquisition process", dirs = system.file("unitTests", 
 		package="RMassBank"), testFileRegexp = "runit.DA.R",
 					#testFuncRegexp = "^test.+",
 					rngKind = "Marsaglia-Multicarry",
 					rngNormalKind = "Kinderman-Ramage")			
-	testData <- suppressWarnings(runTestSuite(testSuite))
-	testData2 <- suppressWarnings(runTestSuite(testSuite2))
+	testData <- suppressWarnings(RUnit::runTestSuite(testSuite))
+	testData2 <- suppressWarnings(RUnit::runTestSuite(testSuite2))
 	
 	file.remove(c("pH_narcotics_Failpeaks.csv","pH_narcotics.RData","pH_narcotics_RA.RData","pH_narcotics_RF.RData"))
-	printTextProtocol(testData)
-	printTextProtocol(testData2)
+	RUnit::printTextProtocol(testData)
+	RUnit::printTextProtocol(testData2)
 	setwd(oldwd)
 	return(testData)
 }
\ No newline at end of file
diff --git a/R/zzz.R b/R/zzz.R
index 9885039bbc5b78829b39ef5bdd08c7b94fdcc6e0..b0a50f5a3275cb33161dfeebb2b909168d7f8fe0 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -4,4 +4,6 @@
   RMassBank.env$testnumber <- 1
   mb <- list()
   attach(RMassBank.env)
-}
\ No newline at end of file
+}
+
+utils::globalVariables(c("cpdID", "isotopes","mzCalc"))
\ No newline at end of file
diff --git a/vignettes/RMassBankXCMS.Rnw b/vignettes/RMassBankXCMS.Rnw
index 92be3ead7e4d3517dc9d0f83bd5d2cbf6fa1f010..0cf6cbe69582ae827c54c3677082bca613348103 100644
--- a/vignettes/RMassBankXCMS.Rnw
+++ b/vignettes/RMassBankXCMS.Rnw
@@ -189,7 +189,7 @@ note that the naming of the csv has to be similar to the mzdata-files,
 with the only difference being the filename extension.  The readMethod
 name for this is "peaklist"
 
-<<eval=FALSE>>=
+<<eval=TRUE>>=
 msmsPeaklist <- newMsmsWorkspace()
 msmsPeaklist@files <- list.files(system.file("spectra.Glucolesquerellin",
                                              package = "RMassBankData"),