usage examples, small code refactoring