improved adding/removing classes in JS [Closes #33]