added listener and improvements