added while loops to call function, retrieve value and continue until user
enter a valid number