Moved hook into custom PHP