Add units parameter to change the units of the code