refactor impl.