Fixed filters.

Also moved JS code around a little.