diff --git a/libcorpus2_whole/io/relwriter.cpp b/libcorpus2_whole/io/relwriter.cpp
index 6f64c38ca0d578eccd8792c5d7e005a7aef6b945..1796c28b35e200ccf8c9cec270da64c351687809 100755
--- a/libcorpus2_whole/io/relwriter.cpp
+++ b/libcorpus2_whole/io/relwriter.cpp
@@ -19,9 +19,11 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 #include <libcorpus2/exception.h>
 #include <libcorpus2_whole/io/relwriter.h>
 
-#include <fstream>
+#include <iostream>
 #include <sstream>
+#include <fstream>
 #include <boost/make_shared.hpp>
+using namespace std;
 
 namespace Corpus2 {
 namespace whole {
@@ -33,73 +35,38 @@ RelationWriter::RelationWriter(const std::string &rela_path)
 
 
 void RelationWriter::write(const std::vector< boost::shared_ptr<Relation> >& relations)
-{
-    	file_.reset(new std::ofstream(rela_path_.c_str()));
+{	
+	ofstream ofs(rela_path_.c_str(), ofstream::out);
 	
 	//header
-	file_->write("<relations>\n",12);
-
+	ofs<<"<relations>\n";
+	
+	//relations
 	foreach (const boost::shared_ptr<Relation>& r, relations){
-		file_->write("   <rel name=\"",14);
-		std::streamsize size = r->name().size();
-		file_->write(r->name().c_str(),size);
-		//Maybe additional info about set is needed in Relation class
-		//file_->write("\" set=\"Anaphora\">\n",18);
-		file_->write("\">\n",3);
-		file_->write("      <from sent=\"",18);
-		size = r->from()->sentence_id().size();
-		file_->write(r->from()->sentence_id().c_str(),size);
-		file_->write("\" chan=\"",8);
-		size = r->from()->channel_name().size();
-		file_->write(r->from()->channel_name().c_str(),size);
-		file_->write("\">",2);
-		int an_num = r->from()->annotation_number();
-		std::ostringstream ss;
-		ss << an_num;
-		std::string str = ss.str();
-		size=str.size();
-		file_->write(str.c_str(),size);
-		file_->write("</from>\n",8);
-		file_->write("      <to sent=\"",16);
-                size = r->to()->sentence_id().size();
-                file_->write(r->to()->sentence_id().c_str(),size);
-                file_->write("\" chan=\"",8);
-                size = r->to()->channel_name().size();
-                file_->write(r->to()->channel_name().c_str(),size);
-                file_->write("\">",2);
-                an_num = r->to()->annotation_number();
-                std::ostringstream ss1;
-                ss1 << an_num;
-                str = ss1.str();
-		size=str.size();
-                file_->write(str.c_str(),size);
-                file_->write("</to>\n",6);
-		//file_->write("\n",1);
-		file_->write("   </rel>",9);
-		file_->write("\n",1);
+		ofs<<"   <rel name=\"";
+		ofs<<r->name().c_str()<<"\">"<<endl;
+		ofs<<"      <from sent=\"";
+		ofs<<r->from()->sentence_id();
+		ofs<<"\" chan=\"";
+		ofs<<r->from()->channel_name();
+		ofs<<"\">";
+		ofs<<r->from()->annotation_number();
+		ofs<<"</from>"<<endl;
+		ofs<<"      <to sent=\"";
+		ofs<<r->to()->sentence_id();
+		ofs<<"\" chan=\"";
+		ofs<<r->to()->channel_name();
+		ofs<<"\">";
+		ofs<<r->to()->annotation_number();
+		ofs<<"</to>"<<endl;
+		ofs<<"   </rel>"<<endl;
 	}
-	
-	
-	
         //footer
-	file_->write("</relations>",12);
-        file_->close();
+	ofs<<"</relations>";
+	ofs.close();
 }
 
 
-void write_relation(const boost::shared_ptr<Relation>& r)
-{
-	//std::streamsize size = r->from()->sentence_id().size();
-	//f->write(r->from()->sentence_id().c_str(),size);
-
-}
-  
-void do_header(){
-}
-
-void do_footer(){
-}
-
 
 } // whole ns
 } // Corpus2 ns
diff --git a/libcorpus2_whole/io/relwriter.h b/libcorpus2_whole/io/relwriter.h
index e3b344c22f5db1be8c075010f5041d8f8e39805b..6f821154deb24b3e4e8c450c9800d27b6f4b8ac5 100755
--- a/libcorpus2_whole/io/relwriter.h
+++ b/libcorpus2_whole/io/relwriter.h
@@ -24,8 +24,6 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 
 #include <libcorpus2_whole/relation.h>
 
-#include <libcorpus2/io/xmlwriter.h>
-
 #include <iostream>
 
 namespace Corpus2 {
@@ -33,8 +31,7 @@ namespace whole {
 
 	
 /**
- * A reader for realtion documents. Note that document is read into memory
- * before any processing may take place.
+ * A writer for realtion documents. 
  */
 class RelationWriter {
 public:
@@ -44,6 +41,7 @@ public:
 	 */
 	RelationWriter(const std::string &rela_path);
 
+
 	/**
 	 * Lazy relations accessor.
 	 * If relations are not readed then read relations and returns list of them.
@@ -54,29 +52,10 @@ public:
 
 private:
 
-  void write_relation(const boost::shared_ptr<Relation>& r);
-  
-  void do_header();
-
-	void do_footer();
-	
-
-	// -------------------------------------------------------------------------
-	/// List of the relations in given relation file
-	std::vector< boost::shared_ptr<Relation> > relations_;
-
 	/// Path to file with relations
 	std::string rela_path_;
 
-	/// File pointer
-	boost::shared_ptr<std::ofstream> file_;
 
-	// -------------------------------------------------------------------------
-	// Temporary information of actual parsing relation
-	std::string rel_name_;
-	std::string ann_number_;
-	boost::shared_ptr<DirectionPoint> rel_from_;
-	boost::shared_ptr<DirectionPoint> rel_to_;
 };
 
 } // whole ns
diff --git a/swig/relationwriter.i b/swig/relationwriter.i
index 41f23f4f6e8cb85940b64ffd92f71efe27b1597e..1cb9f1d2ed52176c3abaf3971a11729973e6de3e 100755
--- a/swig/relationwriter.i
+++ b/swig/relationwriter.i
@@ -9,14 +9,11 @@
 
 namespace Corpus2 {
 namespace whole {
-  class RelationWriter {
-  public:
-    RelationWriter(const std::string &rela_path);
-    void write(const std::vector< boost::shared_ptr<Relation> > relations);
-  private:
-    void do_header();
-    void do_footer();
-    //void write_relation(const boost::shared_ptr<Relation>& r);
+	class RelationWriter {
+  	public:
+  		RelationWriter(const std::string &rela_path);
+		void write(const std::vector< boost::shared_ptr<Relation> > relations);
+
 };
 } // whole ns
 } // Corpus2 ns