Changes to DB schema

Various fixes