Same comment as above. Also, consider extracting this to a helper function.