Use correct min and max values when getting the bounds.
Add more test data and tests.
Updates #14