Use self executing recursive function to clean up upsert
Remove unneeded console.log