public static String replace(String callCode, String oldVariableName,
			String newVariableName) {

		ArrayList<String> arrayList = new ArrayList<String>(Arrays.asList("+",
				"-", "*", "/", ",", ")", "(", ".", "", " ", "{", "}", "[", "]",
				"%", "&", "|", "<", ">", "=", "?", "!", ":",
				System.getProperty("line.separator")));

		// For every appearance of the old identifier split the call code in
		// a prefix, the identifier and a postfix

		int lIndex1 = 0; // bounds of prefix
		int lIndex2;
		int rIndex1; // bounds of postfix
		int rIndex2 = callCode.length();
		int index = callCode.indexOf(oldVariableName); // index of the
														// identifier

		while (index != -1) { // there exists an occurance of the identifier
			// set the bounds
			rIndex2 = callCode.length();
			if (index > 0) {
				lIndex2 = index - 1;
			} else {
				lIndex2 = 0;
			}
			if (index < callCode.length()) {
				rIndex1 = index + oldVariableName.length();
			} else {
				rIndex1 = callCode.length();
			}

			String lChar;
			if (lIndex2 == 0) {
				lChar = "";
			} else {
				lChar = callCode.substring(lIndex2, lIndex2 + 1);
			}
			String rChar = callCode.substring(rIndex1, rIndex1 + 1);

			// proofs that the identifier is not a part of another one
			if (arrayList.contains(lChar) && arrayList.contains(rChar)) {
				String prefix;
				if (lIndex2 == 0) {
					prefix = "";
				} else {
					prefix = callCode.substring(lIndex1, lIndex2 + 1);
				}
				String postfix = callCode.substring(rIndex1, rIndex2);

				// removes the identifier's call "Main." if present
				if (lIndex2 - 4 >= 0) {
					String identifierBeforeVariable = callCode.substring(
							lIndex2 - 4, lIndex2 + 1);
					if (identifierBeforeVariable.equals(CodeGen.mainClassName
							+ ".")) {
						prefix = callCode.substring(lIndex1, lIndex2 - 4);
					}
				}
				callCode = prefix + newVariableName + postfix;
			}

			index = callCode.indexOf(oldVariableName, rIndex1);
		}
		return callCode;
	}