just reproduce the source code in readme for easy skimming