consolidates functions