consolidating code