Updates and added more test cases.