added test cases and other final stuff