moved functionality to hook