Made xcopen function