adding duplicate name check, optimization