Improved the optimized data retrieval

When there are less data points stored than requested, just return the raw data, regardless if requested as optimized or raw.
Updated the junit tests to reflect the changes and to fix some issues from the past.