fixed some things; still doesn't quite work