Added code (originally on PasteBin) and improved README.md