use the latest datapoint after sorting by timestamp

The array of datapoints returned by AWS is not sorted by default and the current implementation will give back mixed results when there are multiple datapoints involved.

This fixes the issue by sorting by timestamp and returning the latest datapoint.