refator template object creation
more preparation for search