Example of how to use generator