diff --git a/niflib.cpp b/niflib.cpp
index 94547bae708c20dc091e80a7c0cd2d268dd22894..a9b4717132cbcb83aee2200c811524a717c72ab0 100644
--- a/niflib.cpp
+++ b/niflib.cpp
@@ -1088,6 +1088,20 @@ unsigned int Kfm::Read( istream & in ) {
 		unk_int3 = ReadUInt(in);
 		for ( vector<KfmAction>::iterator it = actions.begin(); it != actions.end(); it++ ) it->Read(in, version);
 	};
+
+	// Retrieve action names
+	if ( version >= VER_KFM_2_0_0_0b ) {
+		string model_name = nif_filename.substr(0, nif_filename.length()-4); // strip .nif extension
+		for ( vector<KfmAction>::iterator it = actions.begin(); it != actions.end(); it++ ) {
+			string action_name = it->action_filename.substr(0, it->action_filename.length()-3); // strip .kf extension
+			if (action_name.find( model_name + "_" ) == 0)
+				action_name = action_name.substr(model_name.length() + 1, string::npos);
+			if (action_name.find( master + "_" ) == 0)
+				action_name = action_name.substr(master.length() + 1, string::npos);
+			it->action_name = action_name;
+		};
+	};
+
 	return version;
 };
 
@@ -1105,4 +1119,28 @@ void Kfm::Write( ostream & out, uint version ) {
 		else throw runtime_error("Cannot write KFM file of this version.");
 	};
 };
-*/
\ No newline at end of file
+*/
+
+blk_ref Kfm::MergeActions( string const & path ) {
+	// Read NIF file
+	cout << path + '\\' + nif_filename << endl;
+	blk_ref nif = ReadNifTree( path + '\\' + nif_filename);
+	
+	// Read Kf files
+	vector<blk_ref> kf;
+	for ( vector<KfmAction>::iterator it = actions.begin(); it != actions.end(); it++ ) {
+		string action_filename = path + '\\' + it->action_filename;
+		// Check if the file exists.
+		// Probably we should check some other field in the Kfm file to determine this...
+		bool exists = false;
+		fstream fin;
+		fin.open(action_filename.c_str(), ios::in);
+		if( fin.is_open() ) exists = true;
+		fin.close();
+		// Import it, if it exists.
+		if (exists) kf.push_back( ReadNifTree(action_filename) );
+	};
+	
+	// TODO: merge everything into the nif file
+	return nif;
+}
diff --git a/niflib.h b/niflib.h
index 8ab41049f3af5f554b99fcbe5d188eb856edaa9f..b2e558d1f90e9600216a81b81bf932d3ee24829e 100644
--- a/niflib.h
+++ b/niflib.h
@@ -3409,7 +3409,7 @@ struct Kfm {
 	 * unsigned int ver = kfm.Read( "test_in.kfm" );
 	 * if ( ver == VER_UNSUPPORTED ) cout << "unsupported" << endl;
 	 * else if ( ver == VER_INVALID ) cout << "invalid" << endl;
-	 * else cout << "Describes keyframes for NIF file " << kfm.nif_file_name << "." << endl;
+	 * else cout << "Describes keyframes for NIF file " << kfm.nif_filename << "." << endl;
 	 *
 	 * \endcode
 	 * 
@@ -3422,11 +3422,43 @@ struct Kfm {
 	 * elif ( ver == VER_INVALID ):
 	 *     print "invalid"
 	 * else:
-	 *      print "Describes keyframes for NIF file %s."%kfm.nif_file_name
+	 *     print "Describes keyframes for NIF file %s."%kfm.nif_filename
 	 * \endcode
 	 */
 	unsigned int Read( string const & file_name ); // returns Kfm version
 	unsigned int Read( istream & in ); // returns Kfm version
+
+	/*!
+	 * Reads the NIF file and all KF files referred to in this KFM, and returns the root block of the resulting NIF tree.
+	 * \param path The file path; usually, this should be the directory where the KFM file was read from.
+	 * \return The root block of the NIF tree.
+	 * 
+	 * <b>Example:</b> 
+	 * \code
+	 * Kfm kfm;
+	 * unsigned int ver = kfm.Read( "test_in.kfm" );
+	 * if ( ver == VER_UNSUPPORTED ) cout << "unsupported" << endl;
+	 * else if ( ver == VER_INVALID ) cout << "invalid" << endl;
+	 * else {
+	 *   blk_ref root = kfm.MergeActions(".");
+	 *   cout << root << endl;
+	 * };
+	 *
+	 * \endcode
+	 * 
+	 * <b>In Python:</b>
+	 * \code
+	 * kfm = Kfm()
+	 * ver = kfm.Read( "test_in.kfm" )
+	 * if ( ver == VER_UNSUPPORTED ):
+	 *     print "unsupported"
+	 * elif ( ver == VER_INVALID ):
+	 *     print "invalid"
+	 * else:
+	 *     print kfm.MergeActions(".")
+	 * \endcode
+	 */
+	blk_ref Kfm::MergeActions( string const & path );
 	//void Write( string const & file_name, unsigned int version );
 	//void Write( ostream & out, unsigned int version );
 };