added duplication detection. still not exactly how i want it, but
getting there.