Moves the appendix to the end, and minor changes.
appendix fix
Appendix example code added.