I think we should take this opportunity to add unit tests for this method since it's used all over the place.