rewritten database output/input