validation added, test cases fixed