Better handling various file types