Also shouldn't we make this global given that it should be reusable? Well, isn't it already used somewhere else?