Add response encapsulation function