Cleaned the code. Added the license header.
Cleaner and more consistent examples.