added map sorting to output