changed click events to use delegatedHandler