more junit tests and  less bugs