Some progress
Handle more data types, set outside values to MIN(type)
Some cleaning