Updates to first pages version of chapters 2,3, & 5

Fixed various bugs, renamed some identifiers for clarity, and beautified
some JavaScript and HTML files