database and zoo refactored and some more tests added