Add duplicate check. Not working. Needs to be redone (commit @ work)