fix merging issues.Added function for 'opening' & 'closing' tiles