Implemented @keflavich’s suggestion