Added check to prevent double entries in folders