simple logic refactor for example