added tests. caught some buggers.