added license info, and code improvements.