refactored withmore clear sort method and initialized db hash