adding listener code