Added wrap and unwrap functions