Instead of removing duplicates at the end of the frame, let's change `addCredit` to check for duplicates before adding.  That will save us an array allocation here every frame.