Describe basic algorithm in more detail.