Added more complex logic