working but small issue with duplication on re-run