Fixed tons of bugs. Still doesn't quite work.