Can we put this in a separate function and document what it does?