U: refactoring codes