JS changes

Changed most of the .on event handlers to bind directly to the DOM,
simplified code in updateVisibility function, and fixed toggleRemove to
work more consistently