Fix broken code formatting in README.

Fixed broken code blocks and re-formatted a lot of the code to be more readable and correctly indented - it was bugging me!