Updated to support template hooks