Tidy up the data type conversion