Improved handling of units