latest update with logic