VID-98 Use a hook instead of inline code