use a little more complex logic