added sorting to logs