Added code function and associated template