Change click function to include dynamically added elements