[IMP] Code Refactoriced for hook function use