avoid some code duplication