avoid some repeated code