database implementation and testing, more testing all round