Refactor: extract routine