refactor into separate methods