refinished code

lost original code from a computer restart, so remade basic moving code