Changed the usort to be compatible with PHP older versions