This code is modified by Hyeokjune Jeon from