added map sorting utility