cleaning up example for code reuse