[IMP] Improved template and code