added unit conversion to a lot of functions