Time for you kind people the shred all of my hard work to confetti by pointing out where I've made mistakes. My last sorting tutorial was written too quickly, and even though I'm still not sure if I took enough time writing the update, here is the updated version. I rewrote most of the code and changed most of the text, so it's a pretty complete rewrite.
Arigato!