unique insert, no leak, but need to clean up the code