attempted speed enhancement for #342