Fixed sub range bug. Passes all tests.