updated example code for more template compatibility