added test and some changes.