Move global declaration to else branch
Remove redundant variable and binding declaration
Tidy up
Add param check to addListener method