This allows replace to be a named parameter and allows consolidating some duplicate code between various insert methods. This also fixes some tests that broke because batch insert was broken.