diff --git a/src/intersectFile/intersectMain.cpp b/src/intersectFile/intersectMain.cpp
index 9fcb8a1b61f5f38440515e22a6a73d14d911f0d6..a220b24fc4c9f17d0bfe8d1192a91d73dd1522e0 100644
--- a/src/intersectFile/intersectMain.cpp
+++ b/src/intersectFile/intersectMain.cpp
@@ -23,8 +23,8 @@ void intersect_help(void);
 int intersect_main(int argc, char* argv[]) {
 
     Context *context = new Context();
-    context->parseCmdArgs(argc, argv, 1);
-    if (context->getShowHelp() || !context->isValidState()) {
+
+    if (!context->parseCmdArgs(argc, argv, 1) || context->getShowHelp() || !context->isValidState()) {
     	if (!context->getErrorMsg().empty()) {
     		cerr << context->getErrorMsg() << endl;
     	}
diff --git a/src/utils/Contexts/Context.cpp b/src/utils/Contexts/Context.cpp
index 97143c22d847b6d97256a973097ab6376c1ba7f0..6b85806580db37dc85f2f1c3827f5efc3f0e65c4 100644
--- a/src/utils/Contexts/Context.cpp
+++ b/src/utils/Contexts/Context.cpp
@@ -44,6 +44,8 @@ Context::Context()
   _reportNames(false),
   _reportScores(false)
 {
+	_programNames["intersect"] = INTERSECT;
+
 	_validScoreOps.insert("sum");
 	_validScoreOps.insert("max");
 	_validScoreOps.insert("min");
@@ -90,15 +92,17 @@ void Context::openGenomeFile(const BamTools::RefVector &refVector)
 	_genomeFile = new NewGenomeFile(refVector);
 }
 
-void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
+bool Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
 	_argc = argc;
 	_argv = argv;
 	_skipFirstArgs = skipFirstArgs;
 	if (argc < 2) {
 		setShowHelp(true);
-		return;
+		return false;
 	}
 
+	setProgram(_programNames[argv[0]]);
+
 	_argsProcessed.resize(argc - skipFirstArgs, false);
 
 	for (int i=skipFirstArgs; i < argc; i++) {
@@ -112,6 +116,10 @@ void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
 			i++;
 			markUsed(i - skipFirstArgs);
 		} else if (strcmp(argv[i], "-g") == 0) {
+			if (argc <= i+1) {
+				_errorMsg = "Error: -g option given, but no genome file specified.";
+				return false;
+			}
 			openGenomeFile(argv[i+1]);
 			markUsed(i - skipFirstArgs);
 			i++;
@@ -128,6 +136,11 @@ void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
             markUsed(i - skipFirstArgs);
         }
 		if (strcmp(argv[i], "-a") == 0) {
+			if (argc <= i+1) {
+				_errorMsg = "Error: -a option given, but no query file specified.";
+				return false;
+			}
+
 			addInputFile(argv[i+1]);
 			_queryFileIdx = getNumInputFiles() -1;
 			markUsed(i - skipFirstArgs);
@@ -135,6 +148,10 @@ void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
 			markUsed(i - skipFirstArgs);
 		}
         else if(strcmp(argv[i], "-abam") == 0) {
+			if (argc <= i+1) {
+				_errorMsg = "Error: -abam option given, but no query BAM file specified.";
+				return false;
+			}
 			addInputFile(argv[i+1]);
 			_queryFileIdx = getNumInputFiles() -1;
 			markUsed(i - skipFirstArgs);
@@ -143,6 +160,10 @@ void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
 			setInputFileType(_queryFileIdx, FileRecordTypeChecker::BAM_FILE_TYPE);
         }
         else if (strcmp(argv[i], "-b") == 0) {
+			if (argc <= i+1) {
+				_errorMsg = "Error: -b option given, but no database file specified.";
+				return false;
+			}
 			addInputFile(argv[i+1]);
 			_databaseFileIdx = getNumInputFiles() -1;
 			markUsed(i - skipFirstArgs);
@@ -218,13 +239,20 @@ void Context::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
             markUsed(i - skipFirstArgs);
         }
 	}
+	return true;
 }
 
 bool Context::isValidState()
 {
-	if (!Context::cmdArgsValid()) {
+	if (!cmdArgsValid()) {
 		return false;
 	}
+
+	if (getProgram() == INTERSECT && (_queryFileIdx == -1 || _databaseFileIdx == -1)) {
+		_errorMsg = "Error: Intersect program was not given a query and database file.";
+		return false;
+	}
+
 	if (getAnyHit() && getNoHit()) {
 		_errorMsg = "Error: request either -u for anyHit OR -v for noHit, not both.";
 		return false;
diff --git a/src/utils/Contexts/Context.h b/src/utils/Contexts/Context.h
index f65528d00c0ec1cfdbcf1c1c3cce2aa529a60a8c..5638e087b63695fc15a8d7a8b3a83e2c7080cf7a 100644
--- a/src/utils/Contexts/Context.h
+++ b/src/utils/Contexts/Context.h
@@ -74,7 +74,7 @@ public:
 	void setOutputFileType(ContextFileType fileType) { _outputFileType = fileType; }
 	ContextFileType getOutputFileType() const { return _outputFileType; }
 
-	void parseCmdArgs(int argc, char **argv, int skipFirstArgs);
+	bool parseCmdArgs(int argc, char **argv, int skipFirstArgs);
 
 	 //isValidState checks that parameters to context are in an acceptable state.
 	// If not, the error msg string will be set with a reason why it failed.
@@ -193,6 +193,7 @@ protected:
 		ContextRecordType _recordType;
 	};
 	vector<FileEntryType> _inputFiles;
+	map<QuickString, PROGRAM_TYPE> _programNames;
 
 	bool _useMergedIntervals;
 	NewGenomeFile *_genomeFile;