consolidate code