Added new unit tests and improved file validations