Extracting this to a new method is a good idea