changed so event handlers are not on a tags, but on document with event delegation