Refactor into functions; satisfy pylint.