Rewrite to master/slave format