Added more logic