improved custom templates find code;