added tests and a little tuneup
un-broke it