Changed target and added listener from http://stackoverflow.com/a/15102521/3488699