updated logic again