Changed examples to object-oriented version

Also added some documentation to the classes