Cleaning up the code, add expand and collapse code

noticed some errors in this page, so I fixed them, and also put in the
script so that the expand and collapse would work