working on the complex template