Added unit test and changed error message for empty files.