added some tests did some cleaning