completed like python version. total time ~2days.