Add helper functions to refactor boilerplate code.
Refactoring.