Streamlined db access a little, test4 completes in reasonable time