Wrote new example with more modular structure