YD: refactor