the great database rewrite
add headers
remove cruft