Function refactor.