You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2016/01/02 20:42:37 UTC

[3/4] incubator-systemml git commit: Cleanup instruction parsing (removed unnecessary casts, unused methods)

Cleanup instruction parsing (removed unnecessary casts, unused methods)

Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/5878e1db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/5878e1db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/5878e1db

Branch: refs/heads/master
Commit: 5878e1dbba9f7c9161d99e7fdab7e67d5b5da715
Parents: 2fa5a18
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Fri Jan 1 17:51:03 2016 -0800
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Fri Jan 1 17:51:03 2016 -0800

----------------------------------------------------------------------
 .../instructions/CPInstructionParser.java       | 241 ++++++++---------
 .../runtime/instructions/InstructionParser.java |  19 +-
 .../instructions/MRInstructionParser.java       | 267 +++++++++----------
 .../instructions/SPInstructionParser.java       |  38 ++-
 .../cp/AggregateUnaryCPInstruction.java         |   3 +-
 .../instructions/cp/AppendCPInstruction.java    |   3 +-
 .../cp/ArithmeticBinaryCPInstruction.java       |   5 +-
 .../cp/BooleanBinaryCPInstruction.java          |   5 +-
 .../cp/BooleanUnaryCPInstruction.java           |   5 +-
 .../cp/BuiltinBinaryCPInstruction.java          |   3 +-
 .../cp/BuiltinUnaryCPInstruction.java           |   3 +-
 .../cp/CentralMomentCPInstruction.java          |   3 +-
 .../instructions/cp/DataGenCPInstruction.java   |   4 +-
 .../cp/DataPartitionCPInstruction.java          |   3 +-
 .../instructions/cp/FileCPInstruction.java      |   3 +-
 .../cp/FunctionCallCPInstruction.java           |   5 +-
 .../instructions/cp/MMChainCPInstruction.java   |   3 +-
 .../instructions/cp/MMTSJCPInstruction.java     |   3 +-
 .../cp/MatrixIndexingCPInstruction.java         |   3 +-
 .../cp/MatrixReshapeCPInstruction.java          |   3 +-
 .../cp/MultiReturnBuiltinCPInstruction.java     |   4 +-
 .../instructions/cp/PMMJCPInstruction.java      |   3 +-
 .../cp/ParameterizedBuiltinCPInstruction.java   |   4 +-
 .../cp/QuantilePickCPInstruction.java           |   3 +-
 .../cp/QuantileSortCPInstruction.java           |   3 +-
 .../cp/RelationalBinaryCPInstruction.java       |   3 +-
 .../instructions/cp/ReorgCPInstruction.java     |   3 +-
 .../cp/StringInitCPInstruction.java             |   3 +-
 .../cp/UaggOuterChainCPInstruction.java         |   3 +-
 .../instructions/cp/VariableCPInstruction.java  |   2 +-
 .../cpfile/MatrixIndexingCPFileInstruction.java |   3 +-
 .../ParameterizedBuiltinCPFileInstruction.java  |   4 +-
 .../mr/AggregateBinaryInstruction.java          |   3 +-
 .../instructions/mr/AggregateInstruction.java   |   3 +-
 .../mr/AggregateUnaryInstruction.java           |   3 +-
 .../instructions/mr/AppendGInstruction.java     |   3 +-
 .../instructions/mr/AppendInstruction.java      |   3 +-
 .../instructions/mr/AppendMInstruction.java     |   3 +-
 .../instructions/mr/AppendRInstruction.java     |   3 +-
 .../mr/BinUaggChainInstruction.java             |   3 +-
 .../instructions/mr/BinaryInstruction.java      |   6 +-
 .../instructions/mr/BinaryMInstruction.java     |   3 +-
 .../instructions/mr/CM_N_COVInstruction.java    |   6 +-
 .../instructions/mr/CSVReblockInstruction.java  |   2 +-
 .../instructions/mr/CSVWriteInstruction.java    |   2 +-
 .../mr/CombineBinaryInstruction.java            |   3 +-
 .../mr/CombineTernaryInstruction.java           |   3 +-
 .../mr/CombineUnaryInstruction.java             |   3 +-
 .../mr/CumulativeAggregateInstruction.java      |   3 +-
 .../mr/CumulativeOffsetInstruction.java         |   3 +-
 .../mr/CumulativeSplitInstruction.java          |   3 +-
 .../mr/DataPartitionMRInstruction.java          |   3 +-
 .../mr/GroupedAggregateInstruction.java         |   3 +-
 .../mr/GroupedAggregateMInstruction.java        |   3 +-
 .../instructions/mr/MMTSJMRInstruction.java     |   3 +-
 .../mr/MapMultChainInstruction.java             |   3 +-
 .../mr/MatrixReshapeMRInstruction.java          |   3 +-
 .../instructions/mr/PMMJMRInstruction.java      |   3 +-
 .../mr/ParameterizedBuiltinMRInstruction.java   |   3 +-
 .../instructions/mr/PickByCountInstruction.java |   3 +-
 .../instructions/mr/QuaternaryInstruction.java  |   3 +-
 .../instructions/mr/RandInstruction.java        |   3 +-
 .../mr/RangeBasedReIndexInstruction.java        |   3 +-
 .../instructions/mr/ReblockInstruction.java     |   2 +-
 .../mr/RemoveEmptyMRInstruction.java            |   3 +-
 .../instructions/mr/ReorgInstruction.java       |   3 +-
 .../instructions/mr/ReplicateInstruction.java   |   3 +-
 .../instructions/mr/ScalarInstruction.java      |   3 +-
 .../runtime/instructions/mr/SeqInstruction.java |   3 +-
 .../instructions/mr/TernaryInstruction.java     |   3 +-
 .../mr/UaggOuterChainInstruction.java           |   3 +-
 .../instructions/mr/UnaryInstruction.java       |   3 +-
 .../instructions/mr/ZeroOutInstruction.java     |   3 +-
 .../spark/AggregateUnarySPInstruction.java      |   3 +-
 .../spark/ArithmeticBinarySPInstruction.java    |   3 +-
 .../spark/BinUaggChainSPInstruction.java        |   3 +-
 .../spark/CSVReblockSPInstruction.java          |   3 +-
 .../spark/CentralMomentSPInstruction.java       |   3 +-
 .../spark/CheckpointSPInstruction.java          |   3 +-
 .../spark/CovarianceSPInstruction.java          |   3 +-
 .../spark/CumulativeOffsetSPInstruction.java    |   3 +-
 .../spark/MatrixIndexingSPInstruction.java      |   3 +-
 .../spark/ReblockSPInstruction.java             |   3 +-
 .../spark/RelationalBinarySPInstruction.java    |   3 +-
 .../instructions/spark/ReorgSPInstruction.java  |   3 +-
 85 files changed, 360 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java
index d81e363..5b84ea2 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/CPInstructionParser.java
@@ -247,157 +247,150 @@ public class CPInstructionParser extends InstructionParser
 		String2CPFileInstructionType.put( "rmempty"	    , CPINSTRUCTION_TYPE.ParameterizedBuiltin);
 	}
 
-	public static CPInstruction parseSingleInstruction (String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static CPInstruction parseSingleInstruction (String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		if ( str == null || str.isEmpty() )
 			return null;
 
 		CPINSTRUCTION_TYPE cptype = InstructionUtils.getCPType(str); 
 		if ( cptype == null ) 
 			throw new DMLRuntimeException("Unable derive cptype for instruction: " + str);
-		CPInstruction cpinst = CPInstructionParser.parseSingleInstruction(cptype, str);
+		CPInstruction cpinst = parseSingleInstruction(cptype, str);
 		if ( cpinst == null )
 			throw new DMLRuntimeException("Unable to parse instruction: " + str);
 		return cpinst;
 	}
 	
-	public static CPInstruction parseSingleInstruction ( CPINSTRUCTION_TYPE cptype, String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static CPInstruction parseSingleInstruction ( CPINSTRUCTION_TYPE cptype, String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		ExecType execType = null; 
 		
 		if ( str == null || str.isEmpty() ) 
 			return null;
-		switch(cptype) {
-		case AggregateUnary:
-			return (CPInstruction) AggregateUnaryCPInstruction.parseInstruction(str);
 		
-		case AggregateBinary:
-			return (CPInstruction) AggregateBinaryCPInstruction.parseInstruction(str);
-
-		case AggregateTernary:
-			return (CPInstruction) AggregateTernaryCPInstruction.parseInstruction(str);
-			
-		case ArithmeticBinary:
-			return (CPInstruction) ArithmeticBinaryCPInstruction.parseInstruction(str);
-		
-		case Ternary:
-			return (CPInstruction) TernaryCPInstruction.parseInstruction(str);
-		
-		case Quaternary:
-			return (CPInstruction) QuaternaryCPInstruction.parseInstruction(str);
-		
-		case BooleanBinary:
-			return (CPInstruction) BooleanBinaryCPInstruction.parseInstruction(str);
-			
-		case BooleanUnary:
-			return (CPInstruction) BooleanUnaryCPInstruction.parseInstruction(str);
-			
-		case BuiltinBinary:
-			return (CPInstruction) BuiltinBinaryCPInstruction.parseInstruction(str);
-			
-		case BuiltinUnary:
-			return (CPInstruction) BuiltinUnaryCPInstruction.parseInstruction(str);
-			
-		case Reorg:
-			return (CPInstruction) ReorgCPInstruction.parseInstruction(str);
+		switch(cptype) 
+		{
+			case AggregateUnary:
+				return AggregateUnaryCPInstruction.parseInstruction(str);
 			
-		case UaggOuterChain:
-			return (CPInstruction) UaggOuterChainCPInstruction.parseInstruction(str);
+			case AggregateBinary:
+				return AggregateBinaryCPInstruction.parseInstruction(str);
+	
+			case AggregateTernary:
+				return AggregateTernaryCPInstruction.parseInstruction(str);
+				
+			case ArithmeticBinary:
+				return ArithmeticBinaryCPInstruction.parseInstruction(str);
 			
-		case MatrixReshape:
-			return (CPInstruction) MatrixReshapeCPInstruction.parseInstruction(str);	
-
-		case Append:
-			return (CPInstruction) AppendCPInstruction.parseInstruction(str);
+			case Ternary:
+				return TernaryCPInstruction.parseInstruction(str);
 			
-		case RelationalBinary:
-			return (CPInstruction) RelationalBinaryCPInstruction.parseInstruction(str);
+			case Quaternary:
+				return QuaternaryCPInstruction.parseInstruction(str);
 			
-		case File:
-			return (CPInstruction) FileCPInstruction.parseInstruction(str);
+			case BooleanBinary:
+				return BooleanBinaryCPInstruction.parseInstruction(str);
+				
+			case BooleanUnary:
+				return BooleanUnaryCPInstruction.parseInstruction(str);
+				
+			case BuiltinBinary:
+				return BuiltinBinaryCPInstruction.parseInstruction(str);
+				
+			case BuiltinUnary:
+				return BuiltinUnaryCPInstruction.parseInstruction(str);
+				
+			case Reorg:
+				return ReorgCPInstruction.parseInstruction(str);
+				
+			case UaggOuterChain:
+				return UaggOuterChainCPInstruction.parseInstruction(str);
+				
+			case MatrixReshape:
+				return MatrixReshapeCPInstruction.parseInstruction(str);	
+	
+			case Append:
+				return AppendCPInstruction.parseInstruction(str);
+				
+			case RelationalBinary:
+				return RelationalBinaryCPInstruction.parseInstruction(str);
+				
+			case File:
+				return FileCPInstruction.parseInstruction(str);
+				
+			case Variable:
+				return VariableCPInstruction.parseInstruction(str);
+				
+			case Rand:
+				return DataGenCPInstruction.parseInstruction(str);
+				
+			case StringInit:
+				return StringInitCPInstruction.parseInstruction(str);
+				
+			case External:
+				return FunctionCallCPInstruction.parseInstruction(str);
+				
+			case ParameterizedBuiltin: 
+				execType = ExecType.valueOf( str.split(Instruction.OPERAND_DELIM)[0] ); 
+				if( execType == ExecType.CP )
+					return ParameterizedBuiltinCPInstruction.parseInstruction(str);
+				else //exectype CP_FILE
+					return ParameterizedBuiltinCPFileInstruction.parseInstruction(str);
+	
+			case MultiReturnBuiltin:
+				return MultiReturnBuiltinCPInstruction.parseInstruction(str);
+				
+			case QSort: 
+				return QuantileSortCPInstruction.parseInstruction(str);
 			
-		case Variable:
-			return (CPInstruction) VariableCPInstruction.parseInstruction(str);
+			case QPick: 
+				return QuantilePickCPInstruction.parseInstruction(str);
 			
-		case Rand:
-			return (CPInstruction) DataGenCPInstruction.parseInstruction(str);
+			case MatrixIndexing: 
+				execType = ExecType.valueOf( str.split(Instruction.OPERAND_DELIM)[0] ); 
+				if( execType == ExecType.CP )
+					return MatrixIndexingCPInstruction.parseInstruction(str);
+				else //exectype CP_FILE
+					return MatrixIndexingCPFileInstruction.parseInstruction(str);
 			
-		case StringInit:
-			return (CPInstruction) StringInitCPInstruction.parseInstruction(str);
+			case Builtin: 
+				String []parts = InstructionUtils.getInstructionPartsWithValueType(str);
+				if ( parts[0].equals("log") || parts[0].equals("log_nz") ) {
+					if ( parts.length == 3 ) {
+						// B=log(A), y=log(x)
+						return BuiltinUnaryCPInstruction.parseInstruction(str);
+					} else if ( parts.length == 4 ) {
+						// B=log(A,10), y=log(x,10)
+						return BuiltinBinaryCPInstruction.parseInstruction(str);
+					}
+				}
+				else {
+					throw new DMLRuntimeException("Invalid Builtin Instruction: " + str );
+				}
+			case MMTSJ:
+				return MMTSJCPInstruction.parseInstruction(str);
 			
-		case External:
-			//return (CPInstruction) ExtBuiltinCPInstruction.parseInstruction(str);
-			return (CPInstruction) FunctionCallCPInstruction.parseInstruction(str);
+			case PMMJ:
+				return PMMJCPInstruction.parseInstruction(str);
 			
-		case ParameterizedBuiltin: 
-			execType = ExecType.valueOf( str.split(Instruction.OPERAND_DELIM)[0] ); 
-			if( execType == ExecType.CP )
-				return (CPInstruction) ParameterizedBuiltinCPInstruction.parseInstruction(str);
-			else //exectype CP_FILE
-				return (CPInstruction) ParameterizedBuiltinCPFileInstruction.parseInstruction(str);
-
-		case MultiReturnBuiltin:
-			return (CPInstruction) MultiReturnBuiltinCPInstruction.parseInstruction(str);
+			case MMChain:
+				return MMChainCPInstruction.parseInstruction(str);
 			
-		case QSort: 
-			return (CPInstruction) QuantileSortCPInstruction.parseInstruction(str);
-		
-		case QPick: 
-			return (CPInstruction) QuantilePickCPInstruction.parseInstruction(str);
-		
-		case MatrixIndexing: 
-			execType = ExecType.valueOf( str.split(Instruction.OPERAND_DELIM)[0] ); 
-			if( execType == ExecType.CP )
-				return (CPInstruction) MatrixIndexingCPInstruction.parseInstruction(str);
-			else //exectype CP_FILE
-				return (CPInstruction) MatrixIndexingCPFileInstruction.parseInstruction(str);
-		
-		case Builtin: 
-			String []parts = InstructionUtils.getInstructionPartsWithValueType(str);
-			if ( parts[0].equals("log") || parts[0].equals("log_nz") ) {
-				if ( parts.length == 3 ) {
-					// B=log(A), y=log(x)
-					return (CPInstruction) BuiltinUnaryCPInstruction.parseInstruction(str);
-				} else if ( parts.length == 4 ) {
-					// B=log(A,10), y=log(x,10)
-					return (CPInstruction) BuiltinBinaryCPInstruction.parseInstruction(str);
-				}
-			}
-			else {
-				throw new DMLRuntimeException("Invalid Builtin Instruction: " + str );
-			}
-		case MMTSJ:
-			return (CPInstruction) MMTSJCPInstruction.parseInstruction(str);
-		case PMMJ:
-			return (CPInstruction) PMMJCPInstruction.parseInstruction(str);
-		case MMChain:
-			return (CPInstruction) MMChainCPInstruction.parseInstruction(str);
-		
-		case Partition:
-			return (CPInstruction) DataPartitionCPInstruction.parseInstruction(str);	
-
-		case CentralMoment:
-			return (CPInstruction) CentralMomentCPInstruction.parseInstruction(str);
-
-		case Covariance:
-			return (CPInstruction) CovarianceCPInstruction.parseInstruction(str);
-			
-		case INVALID:
-		default: 
-			throw new DMLRuntimeException("Invalid CP Instruction Type: " + cptype );
-		}
-	}
+			case Partition:
+				return DataPartitionCPInstruction.parseInstruction(str);	
 	
-	public static CPInstruction[] parseMixedInstructions ( String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
-		if ( str == null || str.isEmpty() )
-			return null;
-		
-		Instruction[] inst = InstructionParser.parseMixedInstructions(str);
-		CPInstruction[] cpinst = new CPInstruction[inst.length];
-		for ( int i=0; i < inst.length; i++ ) {
-			cpinst[i] = (CPInstruction) inst[i];
+			case CentralMoment:
+				return CentralMomentCPInstruction.parseInstruction(str);
+	
+			case Covariance:
+				return CovarianceCPInstruction.parseInstruction(str);
+				
+			case INVALID:
+			
+			default: 
+				throw new DMLRuntimeException("Invalid CP Instruction Type: " + cptype );
 		}
-		
-		return cpinst;
 	}
-	
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java
index 040c77b..e00cde3 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/InstructionParser.java
@@ -28,10 +28,10 @@ import org.apache.sysml.runtime.instructions.spark.SPInstruction.SPINSTRUCTION_T
 
 
 public class InstructionParser 
-{
-		
-	public static Instruction parseSingleInstruction ( String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
-		
+{		
+	public static Instruction parseSingleInstruction ( String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{	
 		if ( str == null || str.isEmpty() )
 			return null;
 		
@@ -58,7 +58,9 @@ public class InstructionParser
 		}
 	}
 	
-	public static Instruction[] parseMixedInstructions ( String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static Instruction[] parseMixedInstructions ( String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		if ( str == null || str.isEmpty() )
 			return null;
 		
@@ -71,11 +73,4 @@ public class InstructionParser
 		
 		return inst;
 	}
-	
-	public static void printInstructions(Instruction[] instructions)
-	{
-		for(Instruction ins: instructions)
-			System.out.println(ins.toString());
-	}
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java
index a28c00d..5aee907 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/MRInstructionParser.java
@@ -82,8 +82,7 @@ import org.apache.sysml.runtime.matrix.SortMR;
 
 
 public class MRInstructionParser extends InstructionParser 
-{
-	
+{	
 	static public HashMap<String, MRINSTRUCTION_TYPE> String2MRInstructionType;
 	static {
 		String2MRInstructionType = new HashMap<String, MRINSTRUCTION_TYPE>();
@@ -291,152 +290,158 @@ public class MRInstructionParser extends InstructionParser
 	}
 	
 	
-	public static MRInstruction parseSingleInstruction (String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static MRInstruction parseSingleInstruction (String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		if ( str == null || str.isEmpty() )
 			return null;
 		
 		MRINSTRUCTION_TYPE mrtype = InstructionUtils.getMRType(str); 
-		return MRInstructionParser.parseSingleInstruction(mrtype, str);
+		return parseSingleInstruction(mrtype, str);
 	}
 	
-	public static MRInstruction parseSingleInstruction (MRINSTRUCTION_TYPE mrtype, String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static MRInstruction parseSingleInstruction (MRINSTRUCTION_TYPE mrtype, String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		if ( str == null || str.isEmpty() )
 			return null;
 		
-		switch(mrtype) {
-		case Aggregate:
-			return (MRInstruction) AggregateInstruction.parseInstruction(str);
-			
-		case ArithmeticBinary: {
-			String opcode = InstructionUtils.getOpCode(str);
-			String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
-			// extract datatypes of first and second input operands
-			String dt1 = parts[1].split(Instruction.DATATYPE_PREFIX)[1].split(Instruction.VALUETYPE_PREFIX)[0];
-			String dt2 = parts[2].split(Instruction.DATATYPE_PREFIX)[1].split(Instruction.VALUETYPE_PREFIX)[0];
-			if ( dt1.equalsIgnoreCase("SCALAR") || dt2.equalsIgnoreCase("SCALAR") ) {
-				return (MRInstruction) ScalarInstruction.parseInstruction(str);
-			}
-			else {
-				if( BinaryM.isOpcode( opcode ) )
-					return (MRInstruction) BinaryMInstruction.parseInstruction(str);
-				else
-					return (MRInstruction) BinaryInstruction.parseInstruction(str);
+		switch(mrtype) 
+		{
+			case Aggregate:
+				return AggregateInstruction.parseInstruction(str);
+				
+			case ArithmeticBinary: {
+				String opcode = InstructionUtils.getOpCode(str);
+				String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
+				// extract datatypes of first and second input operands
+				String dt1 = parts[1].split(Instruction.DATATYPE_PREFIX)[1].split(Instruction.VALUETYPE_PREFIX)[0];
+				String dt2 = parts[2].split(Instruction.DATATYPE_PREFIX)[1].split(Instruction.VALUETYPE_PREFIX)[0];
+				if ( dt1.equalsIgnoreCase("SCALAR") || dt2.equalsIgnoreCase("SCALAR") ) {
+					return ScalarInstruction.parseInstruction(str);
+				}
+				else {
+					if( BinaryM.isOpcode( opcode ) )
+						return BinaryMInstruction.parseInstruction(str);
+					else
+						return BinaryInstruction.parseInstruction(str);
+				}
 			}
-		}
-		case AggregateBinary:
-			return (MRInstruction) AggregateBinaryInstruction.parseInstruction(str);
 			
-		case AggregateUnary:
-			return (MRInstruction) AggregateUnaryInstruction.parseInstruction(str);
+			case AggregateBinary:
+				return AggregateBinaryInstruction.parseInstruction(str);
+				
+			case AggregateUnary:
+				return AggregateUnaryInstruction.parseInstruction(str);
+				
+			case Ternary: 
+				return TernaryInstruction.parseInstruction(str);
 			
-		case Ternary: 
-			return (MRInstruction) TernaryInstruction.parseInstruction(str);
-		
-		case Quaternary: 
-			return (MRInstruction) QuaternaryInstruction.parseInstruction(str);
+			case Quaternary: 
+				return QuaternaryInstruction.parseInstruction(str);
+				
+			case Rand:
+				return RandInstruction.parseInstruction(str);
+				
+			case Seq:
+				return SeqInstruction.parseInstruction(str);
+				
+			case Reblock:
+				return ReblockInstruction.parseInstruction(str);
 			
-		case Rand:
-			return (MRInstruction) RandInstruction.parseInstruction(str);
+			case Append:
+				return AppendInstruction.parseInstruction(str);
+				
+			case Reorg:
+				return ReorgInstruction.parseInstruction(str);
+				
+			case Replicate:
+				return ReplicateInstruction.parseInstruction(str);
 			
-		case Seq:
-			return (MRInstruction) SeqInstruction.parseInstruction(str);
+			case Unary: {
+				String opcode = InstructionUtils.getOpCode(str);
+				String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
+				if( parts.length==4 && (opcode.equalsIgnoreCase("log") || opcode.equalsIgnoreCase("log_nz")) )
+					return ScalarInstruction.parseInstruction(str);
+				else //default case
+					return UnaryInstruction.parseInstruction(str);
+			}
+			case MMTSJ:
+				return MMTSJMRInstruction.parseInstruction(str);
 			
-		case Reblock:
-			return (MRInstruction) ReblockInstruction.parseInstruction(str);
-		
-		case Append:
-			return (MRInstruction) AppendInstruction.parseInstruction(str);
+			case PMMJ:
+				return PMMJMRInstruction.parseInstruction(str);
 			
-		case Reorg:
-			return (MRInstruction) ReorgInstruction.parseInstruction(str);
+			case MapMultChain:
+				return MapMultChainInstruction.parseInstruction(str);
 			
-		case Replicate:
-			return (MRInstruction) ReplicateInstruction.parseInstruction(str);
-		
-		case Unary: {
-			String opcode = InstructionUtils.getOpCode(str);
-			String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
-			if( parts.length==4 && (opcode.equalsIgnoreCase("log") || opcode.equalsIgnoreCase("log_nz")) )
-				return (MRInstruction) ScalarInstruction.parseInstruction(str);
-			else //default case
-				return (MRInstruction) UnaryInstruction.parseInstruction(str);
-		}
-		case MMTSJ:
-			return (MRInstruction) MMTSJMRInstruction.parseInstruction(str);
-		
-		case PMMJ:
-			return (MRInstruction) PMMJMRInstruction.parseInstruction(str);
-		
-		case MapMultChain:
-			return (MRInstruction) MapMultChainInstruction.parseInstruction(str);
-		
-		case BinUaggChain:
-			return (MRInstruction) BinUaggChainInstruction.parseInstruction(str);
-		
-		case UaggOuterChain:
-			return (MRInstruction) UaggOuterChainInstruction.parseInstruction(str);
+			case BinUaggChain:
+				return BinUaggChainInstruction.parseInstruction(str);
 			
-		case CombineTernary:
-			return (MRInstruction) CombineTernaryInstruction.parseInstruction(str);
+			case UaggOuterChain:
+				return UaggOuterChainInstruction.parseInstruction(str);
+				
+			case CombineTernary:
+				return CombineTernaryInstruction.parseInstruction(str);
+				
+			case CombineBinary:
+				return CombineBinaryInstruction.parseInstruction(str);
+				
+			case CombineUnary:
+				return CombineUnaryInstruction.parseInstruction(str);
+				
+			case PickByCount:
+				return PickByCountInstruction.parseInstruction(str);
+				
+			case CM_N_COV:
+				return CM_N_COVInstruction.parseInstruction(str);
+		
+			case GroupedAggregate:
+				return GroupedAggregateInstruction.parseInstruction(str);
 			
-		case CombineBinary:
-			return (MRInstruction) CombineBinaryInstruction.parseInstruction(str);
+			case MapGroupedAggregate:
+				return GroupedAggregateMInstruction.parseInstruction(str);
 			
-		case CombineUnary:
-			return (MRInstruction) CombineUnaryInstruction.parseInstruction(str);
+			case RangeReIndex:
+				return RangeBasedReIndexInstruction.parseInstruction(str);
 			
-		case PickByCount:
-			return (MRInstruction) PickByCountInstruction.parseInstruction(str);
+			case ZeroOut:
+				return ZeroOutInstruction.parseInstruction(str);
 			
-		case CM_N_COV:
-			return (MRInstruction) CM_N_COVInstruction.parseInstruction(str);
-	
-		case GroupedAggregate:
-			return (MRInstruction) GroupedAggregateInstruction.parseInstruction(str);
-		
-		case MapGroupedAggregate:
-			return (MRInstruction) GroupedAggregateMInstruction.parseInstruction(str);
-		
-		case RangeReIndex:
-			return (MRInstruction) RangeBasedReIndexInstruction.parseInstruction(str);
-		
-		case ZeroOut:
-			return (MRInstruction) ZeroOutInstruction.parseInstruction(str);
-		
-		case MatrixReshape:
-			return (MRInstruction) MatrixReshapeMRInstruction.parseInstruction(str);	
-		
-		case Sort: //workaround for dummy MR sort instruction
-			return SortMR.parseSortInstruction(str);
-		
-		case CSVReblock:
-			return (MRInstruction)CSVReblockInstruction.parseInstruction(str);
+			case MatrixReshape:
+				return MatrixReshapeMRInstruction.parseInstruction(str);	
 			
-		case CSVWrite:
-			return (MRInstruction)CSVWriteInstruction.parseInstruction(str);
+			case Sort: //workaround for dummy MR sort instruction
+				return SortMR.parseSortInstruction(str);
 			
-		case ParameterizedBuiltin:
-			return (MRInstruction)ParameterizedBuiltinMRInstruction.parseInstruction(str);
-		
-		case RemoveEmpty:
-			return (MRInstruction)RemoveEmptyMRInstruction.parseInstruction(str);
+			case CSVReblock:
+				return CSVReblockInstruction.parseInstruction(str);
+				
+			case CSVWrite:
+				return CSVWriteInstruction.parseInstruction(str);
+				
+			case ParameterizedBuiltin:
+				return ParameterizedBuiltinMRInstruction.parseInstruction(str);
 			
-		case Partition:
-			return (MRInstruction)DataPartitionMRInstruction.parseInstruction(str);
+			case RemoveEmpty:
+				return RemoveEmptyMRInstruction.parseInstruction(str);
+				
+			case Partition:
+				return DataPartitionMRInstruction.parseInstruction(str);
+				
+			case CumsumAggregate:
+				return CumulativeAggregateInstruction.parseInstruction(str);
+				
+			case CumsumSplit:
+				return CumulativeSplitInstruction.parseInstruction(str);
 			
-		case CumsumAggregate:
-			return (MRInstruction)CumulativeAggregateInstruction.parseInstruction(str);
+			case CumsumOffset:
+				return CumulativeOffsetInstruction.parseInstruction(str);
 			
-		case CumsumSplit:
-			return (MRInstruction)CumulativeSplitInstruction.parseInstruction(str);
-		
-		case CumsumOffset:
-			return (MRInstruction)CumulativeOffsetInstruction.parseInstruction(str);
-		
-		case INVALID:
-		
-		default: 
-			throw new DMLRuntimeException("Invalid MR Instruction Type: " + mrtype );
+			case INVALID:
+			
+			default: 
+				throw new DMLRuntimeException("Invalid MR Instruction Type: " + mrtype );
 		}
 	}
 	
@@ -453,25 +458,6 @@ public class MRInstructionParser extends InstructionParser
 		return mrinst;
 	}
 	
-	// TODO: figure out if we need all the functions below 
-	
-	//unary operation contains scalar, transform, reorg, aggregate unary
-	public static UnaryInstruction[] parseUnaryInstructions(String str) throws DMLUnsupportedOperationException, DMLRuntimeException 
-	{
-		UnaryInstruction[] inst=null;
-		if(str!=null && !str.isEmpty())
-		{
-			String[] strlist = str.split(Instruction.INSTRUCTION_DELIM);
-			inst = new UnaryInstruction[strlist.length];
-			
-			for(int i=0; i < strlist.length; i++)
-			{
-				inst[i] = (UnaryInstruction) UnaryInstruction.parseInstruction( strlist[i] );
-			}
-		}
-		return inst;
-	}
-	
 	public static AggregateInstruction[] parseAggregateInstructions(String str) throws DMLUnsupportedOperationException, DMLRuntimeException 
 	{
 		AggregateInstruction[] inst=null;
@@ -621,5 +607,4 @@ public class MRInstructionParser extends InstructionParser
 		}
 		return inst;
 	}
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java b/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java
index ea15019..1f5f961 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/SPInstructionParser.java
@@ -76,8 +76,8 @@ import org.apache.sysml.runtime.instructions.spark.WriteSPInstruction;
 import org.apache.sysml.runtime.instructions.spark.ZipmmSPInstruction;
 
 
-public class SPInstructionParser extends InstructionParser {
-	
+public class SPInstructionParser extends InstructionParser 
+{	
 	public static final HashMap<String, SPINSTRUCTION_TYPE> String2SPInstructionType;
 	static {
 		String2SPInstructionType = new HashMap<String, SPInstruction.SPINSTRUCTION_TYPE>();
@@ -253,7 +253,9 @@ public class SPInstructionParser extends InstructionParser {
 		String2SPInstructionType.put( "write"   , SPINSTRUCTION_TYPE.Write);
 	}
 
-	public static Instruction parseSingleInstruction (String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
+	public static SPInstruction parseSingleInstruction (String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{
 		if ( str == null || str.isEmpty() )
 			return null;
 
@@ -261,14 +263,15 @@ public class SPInstructionParser extends InstructionParser {
 		if ( cptype == null )
 			// return null;
 			throw new DMLUnsupportedOperationException("Invalid SP Instruction Type: " + str);
-		Instruction cpinst = SPInstructionParser.parseSingleInstruction(cptype, str);
-		if ( cpinst == null )
+		SPInstruction spinst = parseSingleInstruction(cptype, str);
+		if ( spinst == null )
 			throw new DMLRuntimeException("Unable to parse instruction: " + str);
-		return cpinst;
+		return spinst;
 	}
 	
-	public static Instruction parseSingleInstruction ( SPINSTRUCTION_TYPE sptype, String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
-		
+	public static SPInstruction parseSingleInstruction ( SPINSTRUCTION_TYPE sptype, String str ) 
+		throws DMLUnsupportedOperationException, DMLRuntimeException 
+	{	
 		if ( str == null || str.isEmpty() ) 
 			return null;
 		
@@ -305,10 +308,13 @@ public class SPInstructionParser extends InstructionParser {
 				
 			case MatrixIndexing:
 				return MatrixIndexingSPInstruction.parseInstruction(str);
+				
 			case Reorg:
 				return ReorgSPInstruction.parseInstruction(str);
+				
 			case ArithmeticBinary:
 				return ArithmeticBinarySPInstruction.parseInstruction(str);
+				
 			case RelationalBinary:
 				return RelationalBinarySPInstruction.parseInstruction(str);
 			
@@ -323,6 +329,7 @@ public class SPInstructionParser extends InstructionParser {
 			// Reblock instructions	
 			case Reblock:
 				return ReblockSPInstruction.parseInstruction(str);
+				
 			case CSVReblock:
 				return CSVReblockSPInstruction.parseInstruction(str);
 			
@@ -400,19 +407,4 @@ public class SPInstructionParser extends InstructionParser {
 				throw new DMLUnsupportedOperationException("Invalid SP Instruction Type: " + sptype );
 		}
 	}
-	
-	public static SPInstruction[] parseMixedInstructions ( String str ) throws DMLUnsupportedOperationException, DMLRuntimeException {
-		if ( str == null || str.isEmpty() )
-			return null;
-		
-		Instruction[] inst = InstructionParser.parseMixedInstructions(str);
-		SPInstruction[] cpinst = new SPInstruction[inst.length];
-		for ( int i=0; i < inst.length; i++ ) {
-			cpinst[i] = (SPInstruction) inst[i];
-		}
-		
-		return cpinst;
-	}
-	
-	
 }

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java
index 41d89b8..4950df3 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AggregateUnaryCPInstruction.java
@@ -27,7 +27,6 @@ import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.Builtin;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.MatrixCharacteristics;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -52,7 +51,7 @@ public class AggregateUnaryCPInstruction extends UnaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.AggregateUnary;		
 	}
 	
-	public static Instruction parseInstruction(String str)
+	public static AggregateUnaryCPInstruction parseInstruction(String str)
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java
index 58f0008..41cb68a 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/AppendCPInstruction.java
@@ -24,7 +24,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.OffsetColumnIndex;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -50,7 +49,7 @@ public class AppendCPInstruction extends BinaryCPInstruction
 		_type = type;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static AppendCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java
index 525f6c5..c58b1f2 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ArithmeticBinaryCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 
@@ -42,7 +41,9 @@ public abstract class ArithmeticBinaryCPInstruction extends BinaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.ArithmeticBinary;
 	}
 	
-	public static Instruction parseInstruction ( String str ) throws DMLRuntimeException, DMLUnsupportedOperationException {
+	public static ArithmeticBinaryCPInstruction parseInstruction ( String str ) 
+		throws DMLRuntimeException, DMLUnsupportedOperationException 
+	{
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java
index b85c653..ef28c10 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanBinaryCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.operators.BinaryOperator;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -38,7 +37,9 @@ public class BooleanBinaryCPInstruction extends BinaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.BooleanBinary;
 	}
 	
-	public static Instruction parseInstruction (String str) throws DMLRuntimeException {
+	public static BooleanBinaryCPInstruction parseInstruction (String str) 
+		throws DMLRuntimeException 
+	{
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java
index 5d00203..2d7baaf 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BooleanUnaryCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 import org.apache.sysml.runtime.matrix.operators.SimpleOperator;
 
@@ -37,7 +36,9 @@ public class BooleanUnaryCPInstruction extends UnaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.BooleanUnary;
 	}
 
-	public static Instruction parseInstruction (String str) throws DMLRuntimeException {
+	public static BooleanUnaryCPInstruction parseInstruction (String str) 
+		throws DMLRuntimeException 
+	{
 		CPOperand in = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand out = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		String opcode = parseUnaryInstruction(str, in, out);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java
index 1f6d716..89464ec 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinBinaryCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.functionobjects.Builtin;
 import org.apache.sysml.runtime.functionobjects.ValueFunction;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.matrix.operators.BinaryOperator;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 import org.apache.sysml.runtime.matrix.operators.RightScalarOperator;
@@ -47,7 +46,7 @@ public abstract class BuiltinBinaryCPInstruction extends BinaryCPInstruction
 		return arity;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static BuiltinBinaryCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException {
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java
index b56db42..2980ef1 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/BuiltinUnaryCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.functionobjects.Builtin;
 import org.apache.sysml.runtime.functionobjects.ValueFunction;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 import org.apache.sysml.runtime.matrix.operators.SimpleOperator;
@@ -48,7 +47,7 @@ public abstract class BuiltinUnaryCPInstruction extends UnaryCPInstruction
 		return arity;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static BuiltinUnaryCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{
 		CPOperand in = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java
index 55f1515..0b11d31 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/CentralMomentCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.CM;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.CMOperator;
@@ -39,7 +38,7 @@ public class CentralMomentCPInstruction extends AggregateUnaryCPInstruction
 		super(cm, in1, in2, in3, out, opcode, str);
 	}
 
-	public static Instruction parseInstruction(String str)
+	public static CentralMomentCPInstruction parseInstruction(String str)
 		throws DMLRuntimeException 
 	{
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java
index 9ed2714..e7bb0cf 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataGenCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.lops.DataGen;
 import org.apache.sysml.lops.Lop;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.LibMatrixDatagen;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -166,7 +165,8 @@ public class DataGenCPInstruction extends UnaryCPInstruction
 		this.sparsity = sparsity;
 	}
 
-	public static Instruction parseInstruction(String str) throws DMLRuntimeException 
+	public static DataGenCPInstruction parseInstruction(String str) 
+		throws DMLRuntimeException 
 	{
 		DataGenMethod method = DataGenMethod.INVALID;
 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java
index 650774d..16ee080 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/DataPartitionCPInstruction.java
@@ -28,7 +28,6 @@ import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.ParForProgramBlock.PDataPartitionFormat;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.io.MatrixWriterFactory;
 import org.apache.sysml.runtime.io.WriterBinaryBlock;
@@ -61,7 +60,7 @@ public class DataPartitionCPInstruction extends UnaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static DataPartitionCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/FileCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/FileCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/FileCPInstruction.java
index cef69ac..43d5556 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/FileCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/FileCPInstruction.java
@@ -26,7 +26,6 @@ import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.RemoveFile;
 import org.apache.sysml.runtime.functionobjects.RenameFile;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 import org.apache.sysml.runtime.matrix.operators.SimpleOperator;
@@ -67,7 +66,7 @@ public class FileCPInstruction extends CPInstruction
 			throw new DMLUnsupportedOperationException("Invalid function: " + str);
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static FileCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{
 		String opcode = InstructionUtils.getOpCode(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/FunctionCallCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/FunctionCallCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/FunctionCallCPInstruction.java
index f109540..7e8ac12 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/FunctionCallCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/FunctionCallCPInstruction.java
@@ -81,8 +81,9 @@ public class FunctionCallCPInstruction extends CPInstruction
 	 * extFunct:::foo:::2:::1:::in1:::in2:::out1
 	 * 
 	 */
-	public static Instruction parseInstruction(String str) throws DMLRuntimeException, DMLUnsupportedOperationException {
-		
+	public static FunctionCallCPInstruction parseInstruction(String str) 
+		throws DMLRuntimeException, DMLUnsupportedOperationException 
+	{	
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType ( str );
 		String namespace = parts[1];
 		String functionName = parts[2];

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java
index d2bf270..8d4600e 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMChainCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.lops.MapMultChain.ChainType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -52,7 +51,7 @@ public class MMChainCPInstruction extends UnaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static MMChainCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		//parse instruction parts (without exec type)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java
index a73d7be..cc28230 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MMTSJCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.lops.MMTSJ.MMTSJType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -52,7 +51,7 @@ public class MMTSJCPInstruction extends UnaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static MMTSJCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java
index d3a5d77..c03e7ae 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixIndexingCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -66,7 +65,7 @@ public class MatrixIndexingCPInstruction extends UnaryCPInstruction
 		colUpper = cu;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static MatrixIndexingCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException {
 		
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java
index e512153..8139c62 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MatrixReshapeCPInstruction.java
@@ -23,7 +23,6 @@ import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.LibMatrixReorg;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -56,7 +55,7 @@ public class MatrixReshapeCPInstruction extends UnaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static MatrixReshapeCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java
index 59c3e02..e785375 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/MultiReturnBuiltinCPInstruction.java
@@ -20,13 +20,13 @@
 package org.apache.sysml.runtime.instructions.cp;
 
 import java.util.ArrayList;
+
 import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.LibCommonsMath;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -55,7 +55,7 @@ public class MultiReturnBuiltinCPInstruction extends ComputationCPInstruction
 		return _outputs.get(i);
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static MultiReturnBuiltinCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java
index e38d7fb..2961d21 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/PMMJCPInstruction.java
@@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.cp;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -48,7 +47,7 @@ public class PMMJCPInstruction extends ComputationCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static PMMJCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java
index 4dbc4a5..2245d4c 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ParameterizedBuiltinCPInstruction.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.util.HashMap;
 
 import org.apache.wink.json4j.JSONException;
-
 import org.apache.sysml.lops.Lop;
 import org.apache.sysml.parser.Statement;
 import org.apache.sysml.runtime.DMLRuntimeException;
@@ -32,7 +31,6 @@ import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.ParameterizedBuiltin;
 import org.apache.sysml.runtime.functionobjects.ValueFunction;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.instructions.mr.GroupedAggregateInstruction;
 import org.apache.sysml.runtime.matrix.JobReturn;
@@ -74,7 +72,7 @@ public class ParameterizedBuiltinCPInstruction extends ComputationCPInstruction
 		return paramMap;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static ParameterizedBuiltinCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java
index bf25d99..ab48dd5 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantilePickCPInstruction.java
@@ -27,7 +27,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.MetaData;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -60,7 +59,7 @@ public class QuantilePickCPInstruction extends BinaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static QuantilePickCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java
index a635645..3b748d6 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/QuantileSortCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -52,7 +51,7 @@ public class QuantileSortCPInstruction extends UnaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.QSort;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static QuantileSortCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/RelationalBinaryCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/RelationalBinaryCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/RelationalBinaryCPInstruction.java
index faba42e..c749764 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/RelationalBinaryCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/RelationalBinaryCPInstruction.java
@@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.cp;
 import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.parser.Expression.ValueType;
 import org.apache.sysml.runtime.DMLRuntimeException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.operators.Operator;
 
@@ -36,7 +35,7 @@ public abstract class RelationalBinaryCPInstruction extends BinaryCPInstruction
 		_cptype = CPINSTRUCTION_TYPE.RelationalBinary;
 	}
 	
-	public static Instruction parseInstruction ( String str ) throws DMLRuntimeException {
+	public static RelationalBinaryCPInstruction parseInstruction ( String str ) throws DMLRuntimeException {
 		InstructionUtils.checkNumFields (str, 3);
 		CPOperand in1 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);
 		CPOperand in2 = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java
index 9d72e2e..69ded28 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/ReorgCPInstruction.java
@@ -27,7 +27,6 @@ import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.DiagIndex;
 import org.apache.sysml.runtime.functionobjects.SortIndex;
 import org.apache.sysml.runtime.functionobjects.SwapIndex;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -75,7 +74,7 @@ public class ReorgCPInstruction extends UnaryCPInstruction
 		_ixret = ixret;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static ReorgCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		CPOperand in = new CPOperand("", ValueType.UNKNOWN, DataType.UNKNOWN);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java
index 791e65a..4d7c9e2 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/StringInitCPInstruction.java
@@ -25,7 +25,6 @@ import org.apache.sysml.lops.DataGen;
 import org.apache.sysml.lops.Lop;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.operators.Operator;
@@ -62,7 +61,7 @@ public class StringInitCPInstruction extends UnaryCPInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction(String str) 
+	public static StringInitCPInstruction parseInstruction(String str) 
 		throws DMLRuntimeException 
 	{
 		String opcode = InstructionUtils.getOpCode(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java
index 94fc474..d03b817 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/UaggOuterChainCPInstruction.java
@@ -26,7 +26,6 @@ import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysml.runtime.functionobjects.ReduceAll;
 import org.apache.sysml.runtime.functionobjects.ReduceCol;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.LibMatrixOuterAgg;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
@@ -51,7 +50,7 @@ public class UaggOuterChainCPInstruction extends UnaryCPInstruction
 		instString = istr;
 	}
 
-	public static Instruction parseInstruction(String str)
+	public static UaggOuterChainCPInstruction parseInstruction(String str)
 		throws DMLRuntimeException 
 	{
 		String parts[] = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java
index 9fa2ad0..5c1bbd7 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cp/VariableCPInstruction.java
@@ -236,7 +236,7 @@ public class VariableCPInstruction extends CPInstruction
 		}
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static VariableCPInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{	
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java
index 81d661d..352278c 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/MatrixIndexingCPFileInstruction.java
@@ -24,7 +24,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysml.runtime.controlprogram.context.ExecutionContext;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.instructions.cp.CPOperand;
 import org.apache.sysml.runtime.instructions.cp.MatrixIndexingCPInstruction;
@@ -57,7 +56,7 @@ public class MatrixIndexingCPFileInstruction extends MatrixIndexingCPInstruction
 		super( op, lhsInput, rhsInput, rl, ru, cl, cu, out, opcode, istr);
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static MatrixIndexingCPFileInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
index 51b13de..e598e34 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/cpfile/ParameterizedBuiltinCPFileInstruction.java
@@ -41,7 +41,6 @@ import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.RecordReader;
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapred.TextInputFormat;
-
 import org.apache.sysml.conf.ConfigurationManager;
 import org.apache.sysml.parser.DMLTranslator;
 import org.apache.sysml.parser.Expression.DataType;
@@ -56,7 +55,6 @@ import org.apache.sysml.runtime.controlprogram.parfor.util.IDHandler;
 import org.apache.sysml.runtime.controlprogram.parfor.util.StagingFileUtils;
 import org.apache.sysml.runtime.functionobjects.ParameterizedBuiltin;
 import org.apache.sysml.runtime.functionobjects.ValueFunction;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.instructions.cp.CPOperand;
 import org.apache.sysml.runtime.instructions.cp.ParameterizedBuiltinCPInstruction;
@@ -95,7 +93,7 @@ public class ParameterizedBuiltinCPFileInstruction extends ParameterizedBuiltinC
 	 * @throws DMLRuntimeException
 	 * @throws DMLUnsupportedOperationException
 	 */
-	public static Instruction parseInstruction( String str ) 
+	public static ParameterizedBuiltinCPFileInstruction parseInstruction( String str ) 
 		throws DMLRuntimeException, DMLUnsupportedOperationException 
 	{
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java
index 703a188..d6c3d38 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateBinaryInstruction.java
@@ -28,7 +28,6 @@ import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.functionobjects.Multiply;
 import org.apache.sysml.runtime.functionobjects.Plus;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
@@ -101,7 +100,7 @@ public class AggregateBinaryInstruction extends BinaryMRInstructionBase implemen
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static AggregateBinaryInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionParts ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java
index 83f1617..06708b7 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateInstruction.java
@@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
 import org.apache.sysml.runtime.matrix.mapred.CachedValueMap;
@@ -40,7 +39,7 @@ public class AggregateInstruction extends UnaryMRInstructionBase
 		instString = istr;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static AggregateInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{	
 		String[] parts = InstructionUtils.getInstructionParts ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java
index 214c168..64ee42c 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AggregateUnaryInstruction.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
 import org.apache.sysml.runtime.functionobjects.ReduceDiag;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
@@ -56,7 +55,7 @@ public class AggregateUnaryInstruction extends UnaryMRInstructionBase
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) throws DMLRuntimeException {
+	public static AggregateUnaryInstruction parseInstruction ( String str ) throws DMLRuntimeException {
 		
 		InstructionUtils.checkNumFields ( str, 3 );
 		

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java
index a5ac898..e67291a 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendGInstruction.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
@@ -47,7 +46,7 @@ public class AppendGInstruction extends AppendInstruction
 		_len = _offset + _offset2;
 	}
 
-	public static Instruction parseInstruction ( String str ) 
+	public static AppendGInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionParts ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java
index 72a7f04..0efe595 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendInstruction.java
@@ -22,7 +22,6 @@ package org.apache.sysml.runtime.instructions.mr;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
 import org.apache.sysml.runtime.matrix.mapred.CachedValueMap;
@@ -60,7 +59,7 @@ public class AppendInstruction extends BinaryMRInstructionBase
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction ( String str ) 
+	public static AppendInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String opcode = InstructionUtils.getOpCode(str);

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java
index 10bd584..ad13fb6 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendMInstruction.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import org.apache.sysml.lops.AppendM.CacheType;
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
@@ -46,7 +45,7 @@ public class AppendMInstruction extends AppendInstruction implements IDistribute
 		_offset = offset;
 	}
 	
-	public static Instruction parseInstruction ( String str ) 
+	public static AppendMInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionParts ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java
index dac4621..41cbb06 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/AppendRInstruction.java
@@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
@@ -36,7 +35,7 @@ public class AppendRInstruction extends AppendInstruction
 		super(op, in1, in2, out, cbind, istr);
 	}
 
-	public static Instruction parseInstruction ( String str ) 
+	public static AppendRInstruction parseInstruction ( String str ) 
 		throws DMLRuntimeException 
 	{
 		String[] parts = InstructionUtils.getInstructionParts ( str );

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java
index 5af13b4..9f8bafc 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinUaggChainInstruction.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixBlock;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
@@ -77,7 +76,7 @@ public class BinUaggChainInstruction extends UnaryInstruction
 	 * @return
 	 * @throws DMLRuntimeException
 	 */
-	public static Instruction parseInstruction( String str ) 
+	public static BinUaggChainInstruction parseInstruction( String str ) 
 		throws DMLRuntimeException 
 	{		
 		//check number of fields (2/3 inputs, output, type)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/5878e1db/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java
index e9a2410..d133a90 100644
--- a/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java
+++ b/src/main/java/org/apache/sysml/runtime/instructions/mr/BinaryInstruction.java
@@ -21,7 +21,6 @@ package org.apache.sysml.runtime.instructions.mr;
 
 import org.apache.sysml.runtime.DMLRuntimeException;
 import org.apache.sysml.runtime.DMLUnsupportedOperationException;
-import org.apache.sysml.runtime.instructions.Instruction;
 import org.apache.sysml.runtime.instructions.InstructionUtils;
 import org.apache.sysml.runtime.matrix.data.MatrixIndexes;
 import org.apache.sysml.runtime.matrix.data.MatrixValue;
@@ -42,8 +41,9 @@ public class BinaryInstruction extends BinaryMRInstructionBase
 		instString = istr;
 	}
 	
-	public static Instruction parseInstruction ( String str ) throws DMLRuntimeException {
-		
+	public static BinaryInstruction parseInstruction ( String str ) 
+		throws DMLRuntimeException 
+	{	
 		InstructionUtils.checkNumFields ( str, 3 );
 		
 		String[] parts = InstructionUtils.getInstructionParts ( str );