refactor and stub