implemented template selector