clean up param
break out json
clean up remove and insert functions