diff --git a/DOUAR.f90 b/DOUAR.f90
index ed3378f7d6b9c022fd6183a9c43aa803e912f0f7..3e330c0b520f1509c44cf9f012965827645c604a 100644
--- a/DOUAR.f90
+++ b/DOUAR.f90
@@ -102,6 +102,7 @@ call int_to_char(ciproc,3,iproc)
 threadinfo%Logunit=1000+iproc
 open  (unit=threadinfo%Logunit,file='./DEBUG/mpilogs/Log_'//ciproc//'.dat',status='replace')
 write(threadinfo%Logunit,*) 'This is douar, last modifed 2009-07-14'
+write(*,*)                  'This is douar, last modifed 2009-07-14'
 write(threadinfo%Logunit,'(a,i3)') 'Log file of mpi process',iproc
 
 call heap_init(threadinfo,2000+iproc,'./DEBUG/mpilogs/mem_heap_'//ciproc//'.dat')
@@ -429,44 +430,12 @@ do while (istep.le.params%nstep)
                                           osolve%icon,osolve%nleaves,osolve%x,osolve%y,osolve%z,osolve%nnode)
 
       ! osolve%nnode has been changed by octree_find_node_connectivity.
-      allocate (xyz_t(osolve%nnode),stat=threadinfo%err)
-      call heap (threadinfo, 'xyz_t', 'main', size(xyz_t), 'dp', +1)
-      ! re-size x
-      do i = 1, osolve%nnode
-        xyz_t(i) = osolve%x(i)
-      enddo
-      call heap (threadinfo,'osolve%x', 'main',size(osolve%x),'dp',-1)
-      deallocate (osolve%x)
-      allocate   (osolve%x(osolve%nnode),stat=threadinfo%err)               
-      call heap (threadinfo,'osolve%x', 'main',size(osolve%x),'dp',+1)
-      do i = 1, osolve%nnode
-        osolve%x(i) = xyz_t(i)
-      enddo
-      ! re-size y
-      do i = 1, osolve%nnode
-        xyz_t(i) = osolve%y(i)
-      enddo
-      call heap (threadinfo,'osolve%y', 'main',size(osolve%y),'dp',-1)
-      deallocate (osolve%y)
-      allocate   (osolve%y(osolve%nnode),stat=threadinfo%err)               
-      call heap (threadinfo,'osolve%y', 'main',size(osolve%y),'dp',+1)
-      do i = 1, osolve%nnode
-        osolve%y(i) = xyz_t(i)
-      enddo
-      ! re-size z
-      do i = 1, osolve%nnode
-        xyz_t(i) = osolve%z(i)
-      enddo
-      call heap (threadinfo,'osolve%z', 'main',size(osolve%z),'dp',-1)
-      deallocate (osolve%z)
-      allocate   (osolve%z(osolve%nnode),stat=threadinfo%err)               
-      call heap (threadinfo,'osolve%z', 'main',size(osolve%z),'dp',+1)
-      do i = 1, osolve%nnode
-        osolve%z(i) = xyz_t(i)
-      enddo
-      ! delete the temporary buffer
-      call heap (threadinfo,'xyz_t', 'main',size(xyz_t),'dp',-1)
-      deallocate (xyz_t)
+      ! re-size x, y, z
+      write(threadinfo%logunit,*) 'Before shrink, x,y,z sizes are', size(osolve%x), size(osolve%y), size(osolve%z)
+      call shrink_dp_pointer_array(threadinfo, osolve%x, osolve%nnode)
+      call shrink_dp_pointer_array(threadinfo, osolve%y, osolve%nnode)
+      call shrink_dp_pointer_array(threadinfo, osolve%z, osolve%nnode)
+      write(threadinfo%logunit,*) 'After  shrink, x,y,z sizes are', size(osolve%x), size(osolve%y), size(osolve%z)
       ! resize lsf
       call heap (threadinfo,'osolve%lsf', 'main',size(osolve%lsf),'dp',-1)
       deallocate (osolve%lsf)
@@ -474,6 +443,48 @@ do while (istep.le.params%nstep)
       call heap (threadinfo,'osolve%lsf', 'main',size(osolve%lsf),'dp',+1)
       osolve%lsf=0.d0
 
+      ! This code works.  
+      ! It can be deleted once we verify that the subroutine works.
+      ! ---------------------------------
+      !allocate (xyz_t(osolve%nnode),stat=threadinfo%err)
+      !call heap (threadinfo, 'xyz_t', 'main', size(xyz_t), 'dp', +1)
+      ! re-size x
+      !do i = 1, osolve%nnode
+      !  xyz_t(i) = osolve%x(i)
+      !enddo
+      !call heap (threadinfo,'osolve%x', 'main',size(osolve%x),'dp',-1)
+      !deallocate (osolve%x)
+      !allocate   (osolve%x(osolve%nnode),stat=threadinfo%err)               
+      !call heap (threadinfo,'osolve%x', 'main',size(osolve%x),'dp',+1)
+      !do i = 1, osolve%nnode
+      !  osolve%x(i) = xyz_t(i)
+      !enddo
+      ! re-size y
+      !do i = 1, osolve%nnode
+      !  xyz_t(i) = osolve%y(i)
+      !enddo
+      !call heap (threadinfo,'osolve%y', 'main',size(osolve%y),'dp',-1)
+      !deallocate (osolve%y)
+      !allocate   (osolve%y(osolve%nnode),stat=threadinfo%err)               
+      !call heap (threadinfo,'osolve%y', 'main',size(osolve%y),'dp',+1)
+      !do i = 1, osolve%nnode
+      !  osolve%y(i) = xyz_t(i)
+      !enddo
+      ! re-size z
+      !do i = 1, osolve%nnode
+      !  xyz_t(i) = osolve%z(i)
+      !enddo
+      !call heap (threadinfo,'osolve%z', 'main',size(osolve%z),'dp',-1)
+      !deallocate (osolve%z)
+      !allocate   (osolve%z(osolve%nnode),stat=threadinfo%err)               
+      !call heap (threadinfo,'osolve%z', 'main',size(osolve%z),'dp',+1)
+      !do i = 1, osolve%nnode
+      !  osolve%z(i) = xyz_t(i)
+      !enddo
+      ! delete the temporary buffer
+      !call heap (threadinfo,'xyz_t', 'main',size(xyz_t),'dp',-1)
+      !deallocate (xyz_t)
+
 
 
       !------------------------------------------------------------------------|