Implemented @cwford 's suggestion.