refactor to attach event separately