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

This reverts commit 15999ec0c21849cfa9ff2782cf30a60fbba7e8eb.