Modifications to allow template filtering