Added examples. Code refactoring.