Moved some testing stuff to correct location, fixed some tensor related bugs