Added s.hasClass, and used it in the class selector. Also abstracted class-list parsing.