Improve how trailing zeros are dealt with