updated logic.