Modify Wrap() to return wrapped result as well as return code