debugged rbm code--should be working now