I added a comment on bugzilla. Maybe we should abstract the whole method into a separate module and reuse it everywhere to avoid getting it out of sync.. and test it individually (since it doesn't care about state, it's just a "helper")