Improved some sorting