Make ball into an object and add associated functions inside object