diff --git a/modules/conop/src/heuristic_builder.cc b/modules/conop/src/heuristic_builder.cc
index 3fbff0b9deed63803ab01f5bb049ebbb0010dbc8..eda01852e25d0437367738ac21bc77cc60b7311a 100644
--- a/modules/conop/src/heuristic_builder.cc
+++ b/modules/conop/src/heuristic_builder.cc
@@ -119,8 +119,8 @@ HeuristicBuilder::HeuristicBuilder():
     heuristic_connect::CONN_DEF_ENTRY& def_entry = heuristic_connect::def_entry_table[ec];
     detail::ConnResEntry entry(def_entry.abbrev, def_entry.single,
                                def_entry.chem_class);
-    LOG_DEBUG("creating table entry for " << def_entry.abbrev);
-    LOG_DEBUG("working on bond entries");
+    LOG_TRACE("creating table entry for " << def_entry.abbrev);
+    LOG_TRACE("working on bond entries");
     for (int xx=0;xx<def_entry.name_count;++xx) {
       String name=def_entry.name_list[xx];
       if (name!="OXT")
@@ -152,9 +152,9 @@ HeuristicBuilder::HeuristicBuilder():
         else if(conn_nam[1]==String("-")) { entry.SetPrev(conn_nam[0]);}
         else if(conn_nam[0]==String("+")) { entry.SetNext(conn_nam[1]);}
         else if(conn_nam[1]==String("+")) { entry.SetNext(conn_nam[0]);}
-        LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1]);
+        LOG_TRACE(" " << conn_nam[0] << " " << conn_nam[1]);
             } else {
-        LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1]);
+        LOG_TRACE(" " << conn_nam[0] << " " << conn_nam[1]);
         entry.AddConn(conn_nam[0],conn_nam[1]);
       }
     }
@@ -205,18 +205,18 @@ void HeuristicBuilder::ConnectivityFromAtomNames(const mol::ResidueHandle& res,
      mol::AtomHandleList::iterator it2=it1;
      ++it2;
      for (;it2!=atomlist.end();++it2) {
-       LOG_DEBUG("checking for atom pair (" << it1->GetName() << ","
+       LOG_TRACE("checking for atom pair (" << it1->GetName() << ","
                 << it2->GetName() << ") in connectivity table of "
                 << res.GetKey() << "... ");
        int conn=centry.Check(it1->GetName(),it2->GetName());
        if (conn==1 && this->IsBondFeasible(*it1, *it2)) {
-         LOG_DEBUG( "found");
+         LOG_TRACE( "found");
          editor.Connect(*it1,*it2);
        } else if(conn==2 && this->IsBondFeasible(*it2, *it1)) {
-         LOG_DEBUG( "found (reversed)");
+         LOG_TRACE( "found (reversed)");
          editor.Connect(*it2,*it1);
        } else {
-         LOG_DEBUG( "not found");
+         LOG_TRACE( "not found");
        }
      }
    } else {
@@ -227,7 +227,7 @@ void HeuristicBuilder::ConnectivityFromAtomNames(const mol::ResidueHandle& res,
 
 void HeuristicBuilder::ConnectAtomsOfResidue(mol::ResidueHandle res)
 {
-  LOG_DEBUG("HeuristicBuilder: ConnectAtomsOfResidue on " << res.GetKey() << " " << res.GetNumber());
+  LOG_TRACE("HeuristicBuilder: ConnectAtomsOfResidue on " << res.GetKey() << " " << res.GetNumber());
 
   mol::AtomHandleList atomlist = res.GetAtomList();
   mol::AtomHandleList unk_atomlist;
@@ -237,7 +237,7 @@ void HeuristicBuilder::ConnectAtomsOfResidue(mol::ResidueHandle res)
   for(mol::AtomHandleList::iterator it=atomlist.begin();it!=atomlist.end();++it) {
     ss << " " << it->GetName() << " @" << it->GetPos();
   }
-  LOG_DEBUG(ss.str());
+  LOG_TRACE(ss.str());
 #endif
   std::pair<detail::ConnResEntry,bool> ret = LookupResEntry(res.GetKey());
 
@@ -248,11 +248,11 @@ void HeuristicBuilder::ConnectAtomsOfResidue(mol::ResidueHandle res)
     for(mol::AtomHandleList::iterator it1=unk_atomlist.begin();
         it1!=unk_atomlist.end();
         ++it1) {
-      LOG_DEBUG( "atom " << it1->GetName() << " not found, using distance based connect");
+      LOG_TRACE( "atom " << it1->GetName() << " not found, using distance based connect");
       Builder::DistanceBasedConnect(*it1);
     }
   } else {
-    LOG_DEBUG("no residue entry found, using distance based connect");
+    LOG_TRACE("no residue entry found, using distance based connect");
     for(mol::AtomHandleList::iterator it1=atomlist.begin();
         it1!=atomlist.end();
         ++it1) {
@@ -270,16 +270,16 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0,
   static String fname=flag ? "HeuristicBuilder: ConnectNextXCS" : "HeuristicBuilder: ConnectPrevXCS";
   if(!res0) return; // return if invalid
   mol::XCSEditor editor=res0.GetEntity().EditXCS(mol::BUFFERED_EDIT);
-  LOG_DEBUG(fname << " on " << res0.GetKey() << " " << res0.GetNumber());
+  LOG_TRACE(fname << " on " << res0.GetKey() << " " << res0.GetNumber());
 
   if(!res1) {
     // auto-detect prev or next residue in chain
     // and perform sequence check
     if(flag) {
-      LOG_DEBUG(fname << " autodecting next residue");
+      LOG_TRACE(fname << " autodecting next residue");
       res1 = res0.GetChain().GetNext(res0);
     } else {
-      LOG_DEBUG(fname << " autodecting next residue");
+      LOG_TRACE(fname << " autodecting next residue");
       res1 = res0.GetChain().GetPrev(res0);
     }
   } else {
@@ -292,7 +292,7 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0,
   }
 
   if(!res1) return; // ignore if prev/next residue is invalid
-  LOG_DEBUG(fname << " found second residue " << res1.GetKey() 
+  LOG_TRACE(fname << " found second residue " << res1.GetKey() 
             << " " << res1.GetNumber());
 
   std::pair<detail::ConnResEntry,bool> res0_ret = builder->LookupResEntry(res0.GetKey());
@@ -300,7 +300,7 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0,
 
   if(!res0_ret.second) {
     if(res0.FindAtom("N") && res0.FindAtom("CA") && res0.FindAtom("C")) {
-      LOG_DEBUG("using default peptide for " << res0.GetKey());
+      LOG_TRACE("using default peptide for " << res0.GetKey());
       res0_ret.first=builder->DefaultPeptide();
       res0_ret.second=true;
     }
@@ -308,7 +308,7 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0,
 
   if(!res1_ret.second) {
     if(res1.FindAtom("N") && res1.FindAtom("CA") && res1.FindAtom("C")) {
-      LOG_DEBUG("using default peptide for " << res1.GetKey());
+      LOG_TRACE("using default peptide for " << res1.GetKey());
       res1_ret.first=builder->DefaultPeptide();
       res1_ret.second=true;
     }
@@ -321,13 +321,13 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0,
     String res1_atom_name = res1_centry.GetNext();
 
     if(res0_atom_name.empty() || res1_atom_name.empty()) return;
-    LOG_DEBUG(fname << ": looking up atom names " << res0_atom_name << " " << res1_atom_name);
+    LOG_TRACE(fname << ": looking up atom names " << res0_atom_name << " " << res1_atom_name);
 
     // lookup both atoms in their respective residues
     mol::AtomHandle res0_atom = res0.FindAtom(res0_atom_name);
     mol::AtomHandle res1_atom = res1.FindAtom(res1_atom_name);
     if(res0_atom && res1_atom) {
-      LOG_DEBUG(fname << ": found atoms, connecting");
+      LOG_TRACE(fname << ": found atoms, connecting");
       if(flag) {
         if (builder->DoesPeptideBondExist(res0_atom, res1_atom)) {
           editor.Connect(res0_atom,res1_atom);
@@ -405,11 +405,11 @@ void HeuristicBuilder::AssignTorsionsToResidue(mol::ResidueHandle res)
         mol::TorsionHandle th = editor.AddTorsion(tel[ti].name, ah[0], ah[1],
                                              ah[2], ah[3]);
         if(th) {
-          LOG_DEBUG("added torsion entry for " << tel[ti].a[0] << " "
+          LOG_TRACE("added torsion entry for " << tel[ti].a[0] << " "
                     << tel[ti].a[1] << " " << tel[ti].a[2] << " "
                     << tel[ti].a[3]);
         } else {
-          LOG_DEBUG("no torsion entry for " << tel[ti].a[0] << " "
+          LOG_TRACE("no torsion entry for " << tel[ti].a[0] << " "
                     << tel[ti].a[1] << " " << tel[ti].a[2]
                     << " " << tel[ti].a[3]);
         }
@@ -469,10 +469,10 @@ std::pair<detail::ConnResEntry,bool> HeuristicBuilder::LookupResEntry(const mol:
 
   detail::ConnResEntryMap::iterator pos = emap_.find(key);
   if(pos!=emap_.end()) {
-    LOG_DEBUG("reskey '" << key << "' found in connectivity map");
+    LOG_TRACE("reskey '" << key << "' found in connectivity map");
     return std::make_pair(pos->second,true);
   }
-  LOG_DEBUG("reskey '" << key << "' not found connectivity map");
+  LOG_TRACE("reskey '" << key << "' not found connectivity map");
   return std::make_pair(dummy,false);
 }
 
diff --git a/modules/io/src/mol/entity_io_mae_handler.cc b/modules/io/src/mol/entity_io_mae_handler.cc
index 643630f8abcc567466777a8a2becac8e14ed6445..c1c477c3a3a6e1c159f8ec6b07c444d0a4717009 100644
--- a/modules/io/src/mol/entity_io_mae_handler.cc
+++ b/modules/io/src/mol/entity_io_mae_handler.cc
@@ -32,6 +32,7 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/format.hpp>
 #include <boost/regex.hpp>
+#include <boost/shared_array.hpp>
 
 #include <ost/log.hh>
 #include <ost/conop/conop.hh>
@@ -48,41 +49,6 @@ namespace ost { namespace io {
 
 using boost::format;
 
-  namespace {
-
-    std::vector<std::string> tokenize(const std::string& line)
-    {
-      std::vector<std::string> nrvo;
-      bool in_string=false;
-      int p0=0;
-      for(size_t p1=1;p1<line.size();++p1) {
-        if(in_string) {
-          if(line[p1]=='"') {
-            in_string=false;
-            nrvo.push_back(std::string(line.substr(p0,p1-p0)));
-            ++p1;
-            p0=p1;
-            while(isspace(line[p1]) && p1<line.size()) {++p0;++p1;}
-            --p0; --p1;
-          }
-        } else {
-          if(isspace(line[p1])) {
-            nrvo.push_back(std::string(line.substr(p0+1,p1-p0-1)));
-            ++p1;
-            p0=p1;
-            while(isspace(line[p1]) && p1<line.size()) {++p0;++p1;}
-            --p0; --p1;
-          } else if(line[p1]=='"') {
-            in_string=true;
-            p0=p1+1;
-          }
-        }
-      }
-      return nrvo;
-    }
-
-  }
-
 MAEReader::MAEReader(const boost::filesystem::path& loc):
   curr_chain_(),
   curr_residue_(),
@@ -106,6 +72,7 @@ void MAEReader::Import(mol::EntityHandle& ent)
   static const boost::regex r_ct_block("f_m_ct +\\{");
   static const boost::regex r_atom_block("m_atom\\[.*\\] +\\{");
   static const boost::regex r_delim(":::");
+  static const boost::regex r_end(" *\\} *");
 
   String line;
   bool in_ct_block=false;
@@ -121,13 +88,15 @@ void MAEReader::Import(mol::EntityHandle& ent)
   int i_chain_name=-1;
 
   mol::XCSEditor editor=ent.EditXCS(mol::BUFFERED_EDIT);
+
+  boost::shared_array<char> xline(new char[512]);
   
   while(std::getline(in_,line)) {
-    line = boost::trim_copy(line);
+    //line = boost::trim_copy(line);
     if(in_ct_block) {
       if(in_atom_block) {
         if(parsing_atoms) {
-          if(boost::regex_match(line,r_delim)) {
+          if(boost::regex_search(line,r_delim)) {
             LOG_TRACE( "stopping atom parsing" );
             parsing_atoms=false;
             prop_list.clear();
@@ -140,23 +109,14 @@ void MAEReader::Import(mol::EntityHandle& ent)
             i_chain_name=-1;
           } else {
             // parsing atom line
-            std::vector<std::string> tokens=tokenize(line);
-            for(size_t i=0;i<tokens.size();++i) {
-              LOG_TRACE( "[" << tokens[i] << "] ");
-            }
-            LOG_TRACE("");
-
-            add_atom(ent,editor,
-                     i_atom_name>=0 && i_atom_name<(int)tokens.size() ? tokens[i_atom_name] : "X",
-                     i_atom_xpos>=0 && i_atom_xpos<(int)tokens.size() ? tokens[i_atom_xpos] : "0",
-                     i_atom_ypos>=0 && i_atom_ypos<(int)tokens.size() ? tokens[i_atom_ypos] : "0",
-                     i_atom_zpos>=0 && i_atom_zpos<(int)tokens.size() ? tokens[i_atom_zpos] : "0",
-                     i_res_name>=0 && i_res_name<(int)tokens.size() ? tokens[i_res_name] : "X",
-                     i_res_num>=0 && i_res_num<(int)tokens.size() ? tokens[i_res_num] : "0",
-                     i_chain_name>=0 && i_chain_name<(int)tokens.size() ? tokens[i_chain_name] : "X");
+            memset(xline.get(),0,512);
+            strncpy(xline.get(),line.c_str(),511);
+            parse_and_add_atom(ent,editor,xline.get(),line.size(),
+                               i_atom_name, i_atom_xpos, i_atom_ypos, i_atom_zpos, 
+                               i_res_name, i_res_num, i_chain_name);
           }
         } else { // not parsing atoms
-          if(boost::regex_match(line,r_delim)) {
+          if(boost::regex_search(line,r_delim)) {
             if(i_atom_name==-1 ||
                i_atom_xpos==-1 ||
                i_atom_ypos==-1 ||
@@ -167,36 +127,37 @@ void MAEReader::Import(mol::EntityHandle& ent)
             }
             LOG_TRACE( "starting atom parsing" );
             parsing_atoms=true;
-          } else if(line[0]=='}') {
+          } else if(boost::regex_search(line,r_end)) {
             LOG_TRACE( "exiting atom block" );
             in_atom_block=false;
           } else {
+            std::string line2=boost::trim_copy(line);
             // parsing property line
-            if(line[0]!='#') {
+            if(line2[0]!='#') {
               int pid=prop_list.size()+1;
-              prop_list.push_back(line);
+              prop_list.push_back(line2);
               LOG_TRACE( "found property '" << prop_list.back() << "' id=" << pid );
-              if(line=="s_m_pdb_atom_name") i_atom_name=pid;
-              else if(line=="r_m_x_coord") i_atom_xpos=pid;
-              else if(line=="r_m_y_coord") i_atom_ypos=pid;
-              else if(line=="r_m_z_coord") i_atom_zpos=pid;
-              else if(line=="s_m_pdb_residue_name") i_res_name=pid;
-              else if(line=="i_m_residue_number") i_res_num=pid;
-              else if(line=="s_m_pdb_segment_name") i_chain_name=pid;
+              if(line2=="s_m_pdb_atom_name") i_atom_name=pid;
+              else if(line2=="r_m_x_coord") i_atom_xpos=pid;
+              else if(line2=="r_m_y_coord") i_atom_ypos=pid;
+              else if(line2=="r_m_z_coord") i_atom_zpos=pid;
+              else if(line2=="s_m_pdb_residue_name") i_res_name=pid;
+              else if(line2=="i_m_residue_number") i_res_num=pid;
+              else if(line2=="s_m_pdb_segment_name") i_chain_name=pid;
             }
           }
         }
       } else { // not in atom block
-        if(boost::regex_match(line,r_atom_block)) {
+        if(boost::regex_search(line,r_atom_block)) {
           LOG_TRACE( "entering atom block" );
           in_atom_block=true;
-        } else if(line[0]=='}') {
+        } else if(boost::regex_search(line,r_end)) {
           LOG_TRACE( "exiting ct block" );
           in_ct_block=false;
         }
       }
     } else { // not in ct block
-      if(boost::regex_match(line,r_ct_block)) {
+      if(boost::regex_search(line,r_ct_block)) {
         LOG_TRACE( "entering ct block" );
         in_ct_block=true;
       }
@@ -208,27 +169,95 @@ void MAEReader::Import(mol::EntityHandle& ent)
 }
 
 
-void MAEReader::add_atom(mol::EntityHandle ent,
-                         mol::XCSEditor& editor,
-                         const std::string& aname2, 
-                         const std::string& s_axpos, 
-                         const std::string& s_aypos, 
-                         const std::string& s_azpos, 
-                         const std::string& rname2,
-                         const std::string& s_rnum,
-                         const std::string& cname2)
+void MAEReader::parse_and_add_atom(mol::EntityHandle ent,
+                                   mol::XCSEditor& editor,
+                                   char* line,
+                                   size_t line_len,
+                                   int i_atom_name,
+                                   int i_atom_xpos,
+                                   int i_atom_ypos,
+                                   int i_atom_zpos,
+                                   int i_res_name,
+                                   int i_res_num,
+                                   int i_chain_name)  
 {
-  std::string aname=boost::trim_copy(aname2);
-  std::string rname=boost::trim_copy(rname2);
-  std::string cname=boost::trim_copy(cname2);
+  std::string aname("X");
+  std::string rname("UNK");
+  std::string cname("X");
+  geom::Vec3 apos;
+  int irnum;
+
+  LOG_TRACE("[" << std::string(line) << "]");
+
+  bool in_string=false;
+  char* p0=line;
+  char* p2=line+line_len;
+  while(isspace(*p0) && p0<=p2) ++p0;
+  int tcount=0;
+  for(char* p1=p0+1;p1<p2;++p1) {
+    if(in_string) {
+      if((*p1)=='"') {
+        in_string=false;
+        char* p3=p1;
+        (*p3)='\0';
+        while(isspace(*p0) && p0<=p3) ++p0;
+        while(isspace(*(p3-1)) && p3>p0) --p3;
+        (*p3)='\0';
+        if(tcount==i_atom_name) {
+          aname=std::string(p0);
+        } else if(tcount==i_atom_xpos) {
+          apos[0]=atof(p0);
+        } else if(tcount==i_atom_ypos) {
+          apos[1]=atof(p0);
+        } else if(tcount==i_atom_zpos) {
+          apos[2]=atof(p0);
+        } else if(tcount==i_res_name) {
+          rname=std::string(p0);
+        } else if(tcount==i_res_num) {
+          irnum=atoi(p0);
+        } else if(tcount==i_chain_name) {
+          cname=std::string(p0);
+        }
+        ++tcount;
+        ++p1;
+        p0=p1;
+        while(isspace((*p1)) && p1<p2) {++p0;++p1;}
+        --p0; --p1;
+      }
+    } else { // not instring
+      if(isspace((*p1))) {
+        (*p1)='\0';
+        ++p0;
+        if(tcount==i_atom_name) {
+          aname=std::string(p0);
+        } else if(tcount==i_atom_xpos) {
+          apos[0]=atof(p0);
+        } else if(tcount==i_atom_ypos) {
+          apos[1]=atof(p0);
+        } else if(tcount==i_atom_zpos) {
+          apos[2]=atof(p0);
+        } else if(tcount==i_res_name) {
+          rname=std::string(p0);
+        } else if(tcount==i_res_num) {
+          irnum=atoi(p0);
+        } else if(tcount==i_chain_name) {
+          cname=std::string(p0);
+        }
+        ++tcount;
+        ++p1;
+        p0=p1;
+        while(isspace((*p1)) && p1<p2) {++p0;++p1;}
+        --p0; --p1;
+      } else if((*p1)=='"') {
+        in_string=true;
+        p0=p1+1;
+      }
+    }
+  }
+
   std::string ele=aname.empty() ? "X" : aname.substr(0,1);
   if(isdigit(ele[0])) ele="H";
 
-  int irnum = atoi(s_rnum.c_str());
-  geom::Vec3 apos(atof(s_axpos.c_str()),
-                  atof(s_aypos.c_str()),
-                  atof(s_azpos.c_str()));
-
   mol::ResidueKey rkey(rname);
   
   mol::ResNum rnum(irnum);
@@ -335,14 +364,8 @@ mol::EntityHandle LoadMAE(const String& file_name)
   MAEReader reader(file_name);
   mol::EntityHandle ent=mol::CreateEntity();
   mol::XCSEditor editor=ent.EditXCS(mol::BUFFERED_EDIT);
-  {
-    Profile profile("import MAE");
-    reader.Import(ent);
-  }
-  {
-    Profile profile("connect all");
-    conop::Conopology::Instance().ConnectAll(builder,ent);    
-  }
+  reader.Import(ent);
+  conop::Conopology::Instance().ConnectAll(builder,ent);    
   return ent;
 }
 
diff --git a/modules/io/src/mol/entity_io_mae_handler.hh b/modules/io/src/mol/entity_io_mae_handler.hh
index 9a50d6e3f8694329e0c6a02973f2f8c2bf5c6d5b..4921b9dafb0948dccc445f49d976c8db162378c9 100644
--- a/modules/io/src/mol/entity_io_mae_handler.hh
+++ b/modules/io/src/mol/entity_io_mae_handler.hh
@@ -34,14 +34,17 @@ public:
 
 private:
 
-  void add_atom(mol::EntityHandle ent,
-                mol::XCSEditor& editor,const std::string& s_aname, 
-                const std::string& s_axpos, 
-                const std::string& s_aypos, 
-                const std::string& s_azpos, 
-                const std::string& s_rname,
-                const std::string& s_rnum,
-                const std::string& s_cname);
+  void parse_and_add_atom(mol::EntityHandle ent,
+                          mol::XCSEditor& editor,
+                          char* line,
+                          size_t line_len,
+                          int i_atom_name,
+                          int i_atom_xpos,
+                          int i_atom_ypos,
+                          int i_atom_zpos,
+                          int i_res_name,
+                          int i_res_num,
+                          int i_chain_name);
 
   mol::ChainHandle curr_chain_;
   mol::ResidueHandle curr_residue_;