more testing code and factored out a method.