The Magic of Opening and Closing Gates and its Application page 4 full