added some unit tests and stuff