diff --git a/src/new/finesse/prepare_files/FT_find_mirror_in_blocks.m b/src/new/finesse/prepare_files/FT_find_mirror_in_blocks.m
index d85c63dbffe922168c468fafadf2ed09700e5856..eda8779492351c34ac852c2dc90458cfdb8a9180 100644
--- a/src/new/finesse/prepare_files/FT_find_mirror_in_blocks.m
+++ b/src/new/finesse/prepare_files/FT_find_mirror_in_blocks.m
@@ -35,30 +35,49 @@ function [block_idx,line_idx,mtype] = FT_find_mirror_in_blocks(blocks,mirror)
         % Check for 'm' type and 'bs' type 
         while j<=2
             
-            mirror_str = sprintf('%s%s %s ',mcommand{j},mtype_str{i+1},mirror);
-            
-            % Find block where mirror is defined
-            block_idx = FT_find_text_in_all_blocks(blocks,mirror_str);
-            
-            % If mirror is found quit loop
-            if length(block_idx)~=0
-                mtype = i;
-                i=3;
-                j=3;
-            elseif i==2 && j==2
-                % Error message if mirror isn't found
-                result=sprintf('Component not found: mirror "%s" not found in blocks',mirror);
-                msgid=[baseid,':checkarguments']
-                error(msgid,result);
+            % Find blocks/lines where mirrors are defined
+            mirror_str = sprintf('%s%s',mcommand{j},mtype_str{i+1});
+            [bidx,L1,L2,lines] = FT_find_element_in_all_blocks(blocks,1,mirror_str);
+                        
+            % Search through blocks
+            b=1;
+            while b<=length(bidx)
+                
+                block_idx = bidx(b);
+                lidx = lines(L1(b):L2(b));
+                
+                % Search through lines
+                l=1;
+                while l<=length(lidx)
+                    
+                    line_idx = lidx(l);
+                    
+                    % Find mirror name defined on line
+                    line_str = blocks(block_idx).txt_lines(line_idx);
+                    tmp_mirror = FT_get_element_from_line(line_str,2);
+                    
+                    % Does it match the name of the mirror we're lookign
+                    % for.  If not keep looking.
+                    if strcmp(tmp_mirror,mirror)
+                        mtype = i;
+                        i=3;
+                        j=3;
+                        b=length(bidx);
+                        l=length(lidx);
+                    elseif i==2 && j==2 && b==length(bidx) && l==length(lidx)
+                        % Error message if mirror isn't found
+                        result=sprintf('Component not found: mirror "%s" not found in blocks',mirror);
+                        msgid=[baseid,':checkarguments']
+                        error(msgid,result);
+                    end
+                    l=l+1;
+                end
+                b=b+1;
             end
             j=j+1;
         end
-        
         i=i+1;
     end
-    
-    % Locate mirror line in block
-    line_idx = FT_find_text_in_active_block(blocks(block_idx),mirror_str);
 
 end
 
diff --git a/src/new/finesse/prepare_files/FT_read_const_from_blocks.m b/src/new/finesse/prepare_files/FT_read_const_from_blocks.m
index 89b3b36a2fdcbba63fb0097656e3194a95eaf57a..30e2fd83fe45675c843c394d99ce3c475b40ff28 100644
--- a/src/new/finesse/prepare_files/FT_read_const_from_blocks.m
+++ b/src/new/finesse/prepare_files/FT_read_const_from_blocks.m
@@ -18,8 +18,10 @@ function [const,block_idx] = FT_read_const_from_blocks(blocks,const_name)
     
     baseid = 'find_const_in_all_blocks';
 
-    % Find block in which constant is defined
-    block_idx = FT_find_text_in_all_blocks(blocks,sprintf('const %s',const_name));
+    % Find blocks where constant is defined
+    bidx = FT_find_element_in_all_blocks(blocks,1,'const');
+    bidx2 = FT_find_element_in_all_blocks(blocks(bidx),2,const_name);
+    block_idx = bidx(bidx2);
                 
     % Error message if the constant name isn't found in the blocks or 
     % contant declared more than once
diff --git a/src/new/finesse/prepare_files/FT_replace_const_in_blocks.m b/src/new/finesse/prepare_files/FT_replace_const_in_blocks.m
index 0af63cf09faa243fc09aabb52fc78d8b4a470a8d..d30e54683752279be8a93659fd70936d2cd15e36 100644
--- a/src/new/finesse/prepare_files/FT_replace_const_in_blocks.m
+++ b/src/new/finesse/prepare_files/FT_replace_const_in_blocks.m
@@ -17,11 +17,8 @@
 
 function [blocks] = FT_replace_const_in_blocks(blocks,const_name,const)
 
-    % Define string where the constant is defined
-    const_str = sprintf('const %s ',const_name);
-
     % Find block in which constant is defined
-    block_idx = FT_find_text_in_all_blocks(blocks,const_str);
+    [const_old,block_idx] = FT_read_const_from_blocks(blocks,const_name);
     
     % Find line where constant is defined
     lidx = FT_find_element_in_active_block(blocks(block_idx),2,const_name);