refactor units