Logic is changed, so please update docstring thoroughly. I will continue review after that.