Update README.md

Added code snippets and further explained how the code works.
Added the screenshot image.