Added Tests and some changes