Extracted a helper method.