added a preamble to fix the slanted equations
Alex's edits, and moving the algorithm to a different place