Sort the option values
Clean up import code, fix error messages