speed improvements
removed unnecessary reshapes