refactoring generator examples to work nicely with HA