reviewed, got rid of a few errors, hopefully didn't break anything