code cleanup; added listener that monitors when the user is typing