in reply to Faster way to do this?

Related? Can you help me re-write this code?