Moved cp proc into xbuild event handler