Put testing code in closures correctly.
Clean up prepared statement initialization.