trying to simplify/tidy example code