doing less work in click handler