refactor the way listeners stored and called