Refactored getting dimensions

- Created a Dimensions class with merge methods to get minimum and
maximum over distinct keys in a single pass through the data
- Now returns tuples, and assumes tuples as inputs
- Adjusted tests accordingly