implement hooks