It is still not clear to me how the time between the blocks is determined and how it can be determined at 10 min?
The expected time of mining 2016 blocks is 2016 x 10 minutes = 20160 minutes. The actual time of mining 2016 blocks depends on how fast or how slow previous 2016 blocks were mined. For example, it took 10080 minutes to mine 2016 blocks, which means the average time between blocks was 5 minutes instead of 10 since the actual time was two times less than the expected time. What do we need to do to increase the time between blocks? We need to increase the difficulty of mining by 2 times. We take previous difficulty (whatever it was) and multiply it by two. That is how we ensure the average time of 10 minutes.