multi tenancy refactoring, part 1