New logic for Scanner