refactor the units