Extracting some more common logic