Updated to fix broken code formatting.

Fixed broken code blocks and re-formatted a lot of the code to be more readable and correctly indented.
Merge pull request #7 from danmatthews/master

Fix broken code formatting in README.