Refactor into separate method.