Cleaned up datatype handling