unit tests up in this bitch. Also assorted fixes due to unit tests. woo.