Refactor add events listener