eliminate test code
minor change database handling