Code from Netbeans

Includes Scanner additions. Original file.