Removed redundant check and added catch-all for broken or empty files