Refactor things to function.