add simple example
minor refactoring