completed missing logic