Log function and fixed some major issues with copy