Further optimization of init code

Make use of addEventListener to avoid duplicated handlers