I fixed the problem of reverse pictures replacing their normal counter parts, but it doesn't make sense to me.  I changed the last line in the getUngraded query to say not in instead of in.  Still think it makes more sense the other way but this is what works