Rewrite RBM