Some db changes and tidying up.