move format detection to get_details()