rework hooks. Add debug module