code simplification to avoid duplication