more reshaping to deal with dimension mismatch and also fixed some typos.  removed some of my recent changes as I plan to move to a separate debugging branch