main hooks implemented