Refactor drain and its tests

[#62962462]