Update to the safety check, same code was being used in 2 locations so extracted into method