some refactoring, add a listener to receive input via event dispatcher