Please add a function to reduce code duplication.