move code out into examples