minor refactoring, added some examples