Improved range calculation