first attempt at cpy function