adjusted logic a little in Scanner