fixed a lot of small errors--it almost works now!