updated version with console-only input