Got it working for multiple tenancies

It needs cleanup for the rest of the changes