making this its own method to facilitate testing