Using a separate function for handling onkeyup event