Fixes to tenants and crud operations, general tidying up