switched out a method to speed up the operation