Adding filename checking and test cases