Added better support for the legacy template