little cleanup, added some tests