big simplification for templateo that should fix ordering errors
adding last test for completeness