Added template helper function