simpler logic - should run faster without the updates