some reduction of code duplication