js refactored toggle code (abstraction wasn't of value)
js used generic clear hook