refactor uC code