A draft version of code. It is just a translate from paper to python