Change `$duration` to `duration` and update wherever else necessary. The `$` smurf-convention is meant to distinguish jquery objects from other variables. `duration` is just a number, correct?