added working moving ball function