sort hash and get result out