Wip rgw next

Review and merge some fixes from Yehuda.