Changed read function to account for input format