you know the code is good when you add a comment that says "sorry"
stealing algorithms from some page that uses *flash* for examples and has a color scheme that looks like it's from 2002